Mayur Tolani
Mayur Tolani

Reputation: 1487

What is the new function for handleOpenURL in Xcode

I am Trying to make an app using a old tutorial. so many things have changed since the tutorial was published. I need to make an facebook login, so going through some posts i learned, FBAppCalls have changed to FBSDKApplicationDelegate, but there was a call like this in the old tutorial

FBAppCall.handleOpenURL(url, sourceApplication:sourceApplication, withSession:PFFacebookUtils.session())

So what will it be in the new Updates of swift/xcode/fb framworks etc.?

Upvotes: 0

Views: 638

Answers (1)

Rohit Pradhan
Rohit Pradhan

Reputation: 3875

Here is the method you can use

func application(application: UIApplication,
        openURL url: NSURL,
        sourceApplication: String?,
        annotation: AnyObject?) -> Bool {

return FBSDKApplicationDelegate.sharedInstance().application(
                application,
                openURL: url,
                sourceApplication: sourceApplication,
                annotation: annotation)
}

for iOS 9 this method gets called & you should use like this

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

        return FBSDKApplicationDelegate.sharedInstance().application(url,
            sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey]! as! String,
            annotation: options[UIApplicationOpenURLOptionsAnnotationKey])

}



func applicationDidBecomeActive(application: UIApplication) {
        FBSDKAppEvents.activateApp()
    }

Upvotes: 2

Related Questions