Handling different URL Schemes in iOS (Facebook and Instagram)

前端 未结 4 1785
陌清茗
陌清茗 2021-01-05 14:21

I am not even sure how to define the problem but here it goes.

I have an application that uses Facebook SDK for user login. I followed the Facebook authorization tut

4条回答
  •  甜味超标
    2021-01-05 14:43

    Swift :-

    Example for use both Google+ and Facebook in swift app, both of them require the OpenURL method in the appDelegate.

    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?,
        annotation: AnyObject?) -> Bool {
    
       println("URL : \(url)")
       if(url.scheme!.isEqual("fb1627825840806667")) {
            println("Facebook url scheme")
    
        return FBSDKApplicationDelegate.sharedInstance().application(
                application,
                openURL: url,
                sourceApplication: sourceApplication,
                annotation: annotation)
    
       } else {
    
            println("Google+ url scheme")
    
           return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation)
    
       }
    }
    

提交回复
热议问题