I added a 3D touch shortcut to my app. When I try it on device, i would get the behavior I want when I try first time. When I open the app, do something, and quit, and try 3D touch again, it won't do the thing I want it to do.
func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {
self.handleShortcutItem(shortcutItem)
completionHandler(true)
}
func handleShortcutItem(shortcutItem: UIApplicationShortcutItem)
{
switch shortcutItem.type {
case "com.loafer.start":
self.presentConfigureViewController()
default: break
}
}
func presentConfigureViewController()
{
guard let navigationController = window?.rootViewController as? UINavigationController
else { return }
let identfier = "ConfigureViewController"
let ConfigureViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier(identfier)
navigationController.pushViewController(ConfigureViewController, animated: false)
}
*ConfigureViewController is the view controller I want the shortcut to navigate me to.
Update: I am wandering why no one is answering my question, so sad. Do you guys need me to provide additional information? Just leave a comment.
Aucun commentaire:
Enregistrer un commentaire