swift – FBSDKApplicationDelegate应用程序openURL:sourceApplication:已弃用注释

前端之家收集整理的这篇文章主要介绍了swift – FBSDKApplicationDelegate应用程序openURL:sourceApplication:已弃用注释前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
与iOS9应用程序openURL:sourceApplication:不推荐使用注释
func application(application: UIApplication,openURL url: NSURL,sourceApplication: String?,annotation: AnyObject?) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application,openURL: url,sourceApplication: sourceApplication,annotation: annotation)
}

所以现在我们应该用;

func application(app: UIApplication,options: [String : AnyObject]) -> Bool {}

FBSDKApplicationDelegate为sourceApplication参数(String)设置什么

func application(app: UIApplication,options: [String : AnyObject]) -> Bool
{
    return FBAppCall.handleOpenURL(url,sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String)
}

如果您的SDK通行证中的注释参数为nil

新SDK

let sourceApplication: String? = options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String 
   return FBSDKApplicationDelegate.sharedInstance().application(app,annotation: nil)

更新2017/04/06:Xcode 8.3,FBSDKCoreKit 4.20.2

func application(_ app: UIApplication,open url: URL,options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    let sourceApplication: String? = options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String
    return FBSDKApplicationDelegate.sharedInstance().application(app,open: url,annotation: nil)
}
原文链接:https://www.f2er.com/swift/320286.html

猜你在找的Swift相关文章