Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FBSDKApplicationDelegate application openURL:sourceApplication:annotation deprecated

with iOS9 application openURL:sourceApplication:annotation is deprecated

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

so now we should use;

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

FBSDKApplicationDelegate what to set for sourceApplication parameter (String)

like image 584
Mihriban Minaz Avatar asked Nov 16 '15 14:11

Mihriban Minaz


1 Answers

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

if you have annotation param in your SDK pass as nil

New SDK

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

Update 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)
}
like image 144
Muthu Ram Avatar answered Oct 04 '22 11:10

Muthu Ram