iOS Swift 2.3:应用程序restorationHandler的正确语法? [英] iOS Swift 2.3: correct syntax for application restorationHandler?

查看:371
本文介绍了iOS Swift 2.3:应用程序restorationHandler的正确语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在iOS项目中使用Swift 2.3设置 Firebase动态链接



当我在AppDelegate中添加这个函数如页面底部所示),我得到的错误是:


未知属性'转义'



<$ p $ (应用程序:UIApplication,继续userActivity:NSUserActivity,restorationHandler:@escaping([Any]?) - >无效) - > Bool {
guard let dynamicLinks = FIRDynamicLinks.dynamicLinks()else {
return false
}
let handled = dynamicLinks.handleUniversalLink(userActivity.webpageURL!){
动态链接,错误)在
// ...
}
返回处理
}

任何想法是Swift 2.3的正确语法吗?

解决方案

使用的是 swift3 ,这里是 swift2.3


$ b $ func application(application:UIApplication,continueUserActivity userActivity:NSUserActivity,restorationHandler:([AnyObject]?) - > Void) - > &&&&&&&&&&&&&&&&&&&&&&& < Bool {

}


I am trying to setup Firebase Dynamic Links in my iOS project using Swift 2.3.

When I add this function in the AppDelegate (as reported at the bottom of this page), I get the error:

Unknown attribute 'escaping'

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    guard let dynamicLinks = FIRDynamicLinks.dynamicLinks() else {
       return false
    }
    let handled = dynamicLinks.handleUniversalLink(userActivity.webpageURL!) {
       (dynamiclink, error) in
       // ...
    }
    return handled
}

any idea which is the correct syntax for Swift 2.3?

解决方案

The method which you are using is for swift3, here is the method for swift2.3

func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {

}

这篇关于iOS Swift 2.3:应用程序restorationHandler的正确语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆