具有 Branch deep linking 的应用程序在通过 deep link 重新打开时显示 UIAlertController 警告

Application with Branch deep linking shows UIAlertController warning on reopening through deep link

我已经使用 Branck iOS SDK 成功实现了深度链接。

然而,在重新打开应用程序时,控制台中会显示以下警告:

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (UIAlertController: 0x16b00800)

我的 AppDelegate 基本代码实现是:

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
    {
        // Branch initialization   
        let branch: Branch = Branch.getInstance()

        branch.initSessionWithLaunchOptions(launchOptions, andRegisterDeepLinkHandler:
            { optParams, error in
            if error == nil, let params = optParams
            {
                print("Branch params: ", params.description)
            }
        })

        return true
    }

    // Respond to URI scheme links
    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool
    {
        print("Branch url URI: ", url)

        // pass the url to the handle deep link call
        Branch.getInstance().handleDeepLink(url)

        return true
    }

    // Respond to Universal Links
    func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool
    {
        print("Branch universal link ")

        Branch.getInstance().continueUserActivity(userActivity)

        return true
    }

}

如何去除以上警告?

要删除警告 AppDelegate 必须另外实现 application:willContinueUserActivityWithType 函数,该函数将 return true

func application(application: UIApplication, willContinueUserActivityWithType userActivityType: String) -> Bool
{
    return true
}