{ "id": "173969", "key": "TIMOB-27359", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2019-08-01T16:13:41.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "20412", "name": "Release 8.1.0", "archived": false, "released": true, "releaseDate": "2019-08-13" } ], "issuelinks": [], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-08-27T12:34:39.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Trying to implement Stripe in iOS with swift I'm not able to show a modal view controller.\r\n\r\nIn order to isolate the cause I've implemented the following call with the same result, the controller does not show up.\r\n\r\n\r\n{code:swift}\r\n@available(iOS 9.0, *)\r\n @objc(openSafari:)\r\n func openSafari(args: Array?) -> Void {\r\n let safariVC = SFSafariViewController(url: NSURL(string: \"https://google.es\") as! URL)\r\n safariVC.delegate=self\r\n TiApp().showModalController(safariVC, animated: true)\r\n \r\n }\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: Unable to open modal controller in swift module", "creator": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "450853", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey [~bgarcia],\r\n\r\nthere is a slight error in your code, but unfortunately also a bug that prevents you from easily using the correct code.\r\n\r\nYou are using {{TiApp()}} which will create a new {{TiApp}} instance. {{TiApp.app()}} to access the singleton instance of {{TiApp}} 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:\r\n\r\n{code:swift}\r\nlet safariVC = SFSafariViewController(url: NSURL(string: \"https://google.es\") as! URL)\r\nlet tiApp: TiApp = TiApp.perform(NSSelectorFromString(\"app\"))!.takeUnretainedValue() as! TiApp\r\ntiApp.showModalController(safariVC, animated: false)\r\n{code}\r\n\r\nThis should do the trick and open the {{SFSafariViewController}}.\r\n\r\nMoving this ticket to TIMOB to address the naming issue and making the singleton properly accessible from Swift.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-08-27T12:32:14.000+0000", "updated": "2019-08-27T12:32:14.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }