sharedapplication open only newer available swift ios9 openurl

swift - only - Aplicación FBSDKApplicationDelegate openURL: sourceApplication: anotación en desuso



openurl options completionhandler:'' is only available on ios 10.0 or newer (2)

con la aplicación iOS9 openURL: sourceApplication: la anotación está en desuso

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool { return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) }

así que ahora debemos usar;

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

FBSDKApplicationDelegate qué establecer para el parámetro sourceApplication (String)


Lo siguiente usado en el sitio de facebook hasta (1 de enero de 2017)

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 }


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

si tiene un parámetro de anotación en su pase de SDK como nulo

Nuevo SDK

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

Actualización 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, sourceApplication: sourceApplication, annotation: nil) }