Recently in Xcode 8 beta 6 (8S201h), this has become a problem.
UIApplicationLaunchOptionsShortcutItemKey
Here's the error :
Anyone else having this issue?
var performShortcutDelegate = true
if let shortcutItem = launchOptions[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
print("ok")
self.shortcutItem = shortcutItem
performShortcutDelegate = false
}
return performShortcutDelegate
The constant has changed (see the documentation). You also need to unwrap launchOptions
before using any values it contains.
Enclosing function is included for context.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if let launchOptions = launchOptions {
if #available(iOS 9.0, *) {
if let shortcutItem = launchOptions[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
print("Shortcut: \(shortcutItem)")
}
}
}
return true
}