UIApplicationLaunchOptionsShortcutItemKey在Swift 3中没有?

Ami*_*lra 7 swift 3dtouch swift3 xcode8 xcode8-beta6

最近在Xcode 8 beta 6(8S201h)中,这已经成为一个问题.

 UIApplicationLaunchOptionsShortcutItemKey
Run Code Online (Sandbox Code Playgroud)

这是错误:

在此输入图像描述

还有谁有相同的问题吗?

var performShortcutDelegate = true
if let shortcutItem = launchOptions[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
    print("ok")
    self.shortcutItem = shortcutItem
    performShortcutDelegate = false
}
return performShortcutDelegate
Run Code Online (Sandbox Code Playgroud)

Naf*_*der 7

常数已更改(请参阅文档).您还需要launchOptions在使用它包含的任何值之前解包.

上下文包括封闭功能.

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
}
Run Code Online (Sandbox Code Playgroud)