Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Somehow not working to me. Anyone works? #7

Closed
Tim77277 opened this issue Nov 30, 2016 · 4 comments
Closed

Somehow not working to me. Anyone works? #7

Tim77277 opened this issue Nov 30, 2016 · 4 comments

Comments

@Tim77277
Copy link

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.

@ricardopereira
Copy link
Owner

@Tim77277 You're using the latest version? Did you look the example? https://github.com/ricardopereira/QuickActions/tree/master/Example

@Tim77277
Copy link
Author

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.

@Tim77277
Copy link
Author

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.

@Tim77277 Tim77277 reopened this Nov 30, 2016
@ricardopereira
Copy link
Owner

Ok, thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants