I have a widget that calls the corresponding application through NSURL and extensionContext to activate a specific action in the application.
In the AppDelegate application:openURL:options: I have:
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool { if let path = url.path{ if path.containsString("action"){ NSNotificationCenter.defaultCenter().postNotificationName(MyViewController.purchasmyActionKey, object: nil) } } return true }
When the application is open and has MyViewController active, the action is excellent. But, if I am on another view controller in the application or application, it closes, the action is not performed.
Can someone put me on the right track?
NB: My main controller is a UITabBarController with various child view controllers. Some of them are UINavigationControllers (which contain grid controllers), while others are ListViewController .
uiviewcontroller swift nsnotificationcenter appdelegate uilocalnotification
tolbard
source share