最近在一个新的应用程序更新之后,我们开始排队

let sourceApplication = options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String

在下面的代码中。我只是想知道为什么它可以是零或者是因为as而崩溃!去串?
    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
    CoreAnalytics.shared.record("AppDelegate", action: "Open URL")
    Branch.getInstance().handleDeepLink(url)
    let sourceApplication = options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String
    let annotation = options[UIApplicationOpenURLOptionsKey.annotation]

    CleverTap.sharedInstance()?.handleOpen(url, sourceApplication: sourceApplication)

    return
        GIDSignIn.sharedInstance().handle(url, sourceApplication: sourceApplication, annotation: annotation) ||
        FBSDKApplicationDelegate.sharedInstance().application(app, open: url, sourceApplication: sourceApplication, annotation: annotation)
}

最佳答案

这是在从苹果钱包通行证打开应用程序时发生的。

关于ios - UIApplicationOpenURLOptionsKey.sourceApplication可以为零吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47987895/

10-14 23:09