[TIMOB-27359] iOS: Unable to open modal controller in swift module
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 8.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Brian GarcĂa |
Assignee | Jan Vennemann |
Created | 2019-08-01T16:13:41.000+0000 |
Updated | 2019-08-27T12:34:39.000+0000 |
Description
Trying to implement Stripe in iOS with swift I'm not able to show a modal view controller.
In order to isolate the cause I've implemented the following call with the same result, the controller does not show up.
@available(iOS 9.0, *)
@objc(openSafari:)
func openSafari(args: Array<Any>?) -> Void {
let safariVC = SFSafariViewController(url: NSURL(string: "https://google.es") as! URL)
safariVC.delegate=self
TiApp().showModalController(safariVC, animated: true)
}
Hey [~bgarcia], there is a slight error in your code, but unfortunately also a bug that prevents you from easily using the correct code. You are using
TiApp()
which will create a newTiApp
instance.TiApp.app()
to access the singleton instance ofTiApp
that's properly initialized would be the correct way. However, due to the naming of that method Swift won't correctly recognize it as the singleton getter it is and mark it as unavailable. To access it you need to go through the Objective-C route:This should do the trick and open the
SFSafariViewController
. Moving this ticket to TIMOB to address the naming issue and making the singleton properly accessible from Swift.