iOS9アプリケーションのopenURL:sourceApplication:annotationは廃止予定
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, openURL url: NSURL, options: [String : AnyObject]) -> Bool {}
FBSDKApplicationDelegate sourceApplicationパラメータに設定するもの(文字列)
func application(app: UIApplication, openURL url: NSURL, 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, openURL: url, sourceApplication: sourceApplication, annotation: nil)
2017年4月6日更新: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, sourceApplication: sourceApplication, annotation: nil)
}
以下は、2017年1月1日までFacebookサイトで使用されました
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
let handled = FBSDKApplicationDelegate.sharedInstance().application(app,
open: url,
sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String?,
annotation: options[UIApplicationOpenURLOptionsKey.annotation])
return handled
}