FBSDKApplicationDelegate application openURL:sourceApplication:annotation deprecated

前端 未结 2 1335
无人及你
无人及你 2020-12-29 07:43

with iOS9 application openURL:sourceApplication:annotation is deprecated

func application(application: UIApplication, openURL url: NSURL, sourceApplication:          


        
相关标签:
2条回答
  • 2020-12-29 08:16

    The following used on facebook site till (Jan 1, 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
    }
    
    0 讨论(0)
  • 2020-12-29 08:34
    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)
    }
    
    0 讨论(0)
提交回复
热议问题