Handling openURL: with Facebook and Google

后端 未结 10 1648
长情又很酷
长情又很酷 2021-01-01 09:39

user in my app can login using 2 services : Facebook or Google

everything works fine, however, in the :

- (BOOL)application:(UIApplication *)applicat         


        
10条回答
  •  無奈伤痛
    2021-01-01 10:34

    The Swift version for iOS 9.0 and above of the accepted answer could be something like this:

    import FacebookCore
    
    [...]
    
        func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
            if (GIDSignIn.sharedInstance().handle(url)) {
                return true
            } else if (ApplicationDelegate.shared.application(app, open: url, options: options)) {
                return true
            }
    
            return false
        }
    

    Try to handle the URL with each SDK, the first one that recognizes it ends execution returning true. If no SDK could handle the URL, return false.

    I hope it helps someone,

    Xavi

提交回复
热议问题