小编Ana*_*hik的帖子

如何处理多个社交登录帐户迅速将登录重定向回应用程序?

我正在制作一个应用程序,允许用户从不同的平台(例如google,Facebook,twitter等)登录。在应用程序委托中,我们必须为每个平台实现一个功能application:openURL:options:。目前,我的功能如下所示。

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {

    // Todo handle based on the the arguments and return the bool value to be checked on iPHONE with facebook, google and twitter app
    let handled = FBSDKApplicationDelegate.sharedInstance().application(app, open: url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String!, annotation: options[UIApplicationOpenURLOptionsKey.annotation])

    GIDSignIn.sharedInstance().handle(url, sourceApplication:options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, annotation: [:])

    Twitter.sharedInstance().application(app, open: url, options: options)

    return handled
}
Run Code Online (Sandbox Code Playgroud)

如上所示,我返回的是Facebook的重定向句柄结果。Google和Twitter也返回布尔值。返回上述功能的Facebook,google和twitter的句柄布尔值的最安全正确方法是什么?

twitter facebook ios facebook-sdk-4.0 swift

3
推荐指数
1
解决办法
477
查看次数

标签 统计

facebook ×1

facebook-sdk-4.0 ×1

ios ×1

swift ×1

twitter ×1