Somehow not working to me. Anyone works?
Tim77277 opened this issue · comments
I ran into one problem and couldn't figure it out what happened. I followed the instructions in the README and also checked the example code, however in performActionForShortcutItem function
func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: Bool -> Void) {
guard let quickActions = quickActions else { return completionHandler(false) }
guard let rootViewController = window?.rootViewController else { return completionHandler(false) }
completionHandler(quickActions.handle(rootViewController, shortcutItem: shortcutItem))
}
This line always return false
quickActions.handle(rootViewController, shortcutItem: shortcutItem)
I don't know if it is because I set something wrong or it is because of the library.
@Tim77277 You're using the latest version? Did you look the example? https://github.com/ricardopereira/QuickActions/tree/master/Example
UPDATE:
I just solved the problem. It wasn't library's problem. The reason it didn't work before was because I used a UISplitViewController in my project. So when the function inside completionHandler got called
quickActions.handle(rootViewController, shortcutItem: shortcutItem)
It always returned false simply because my rootViewController was not the controller that I want to handle the QuickActionSupport protocol.
Hopefully it would help some people who encounter the same problem as me.
UPDATE:
I just solved the problem. It wasn't library's problem. The reason it didn't work before was because I use a UISplitViewController in my project. So when the function inside completionHandler got called
quickActions.handle(rootViewController, shortcutItem: shortcutItem)
It always returned false simply because my rootViewController is not the controller that I want to handle the QuickActionSupport protocol.
Hopefully it would help some people who encounter the same problem as me.
Ok, thanks for sharing!