与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) }