Launching with UIApplicationShortcutItem

后端 未结 6 654
南旧
南旧 2021-01-31 17:38

I\'m implementing some 3D touch quick actions for my iOS 9 app in swift, and I have a curious issue. When my app is in the background and I launch with the quick action, everyth

6条回答
  •  广开言路
    2021-01-31 18:34

    Replace your didfinishlaunching method with this one.

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
    
      if let shortcutItem =
           launchOptions?[UIApplicationLaunchOptionsShortcutItemKey]
           as? UIApplicationShortcutItem {
    
        handleShortcut(shortcutItem)
        return false
      }
      return true
    }
    

提交回复
热议问题