Facebook登录在iOS 11上显示另一个确认弹出窗口 [英] Facebook login shows an additional confirmation popup on iOS 11

查看:258
本文介绍了Facebook登录在iOS 11上显示另一个确认弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Facebook SDK for swift通过facebook实现了登录。它在iOS 10.3上按预期工作,但在iOS 11上显示并显示其他弹出窗口,要求用户允许通过facebook.com登录。

I have implemented login through facebook using facebook SDK for swift. It works as expected on iOS 10.3, but on iOS 11 it shows and additional popup that asks the user to allow sign in through facebook.com.

这会在登录过程中再添加一个步骤,从而减慢登录过程。有没有办法如何配置应用程序默认允许这个,从而删除烦人的弹出窗口?

This adds one more step in the login process that slows down the login process. Is there a way how to to configure the app to allow this by default, thus remove the annoying popup?

我正在使用facebook-sdk-swift 0.2.0(FBSDK)版本是4.26.0)通过可可豆荚添加。

I am using facebook-sdk-swift 0.2.0 (FBSDK version is 4.26.0) added through cocoa pods.

info.plist中的配置

<key>FacebookAppID</key>
<string>xxxxxxxxxxxxxxx</string>
<key>FacebookDisplayName</key>
<string>XXXXX</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>facebook.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>facebook</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fbxxxxxxxxxxxxxxx</string>
        </array>
    </dict>
</array>

中的代码AppDelegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    return SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
}

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

LoginController 在处理程序中有一个自定义登录按钮:

LoginController has a custom login button with this in handler:

    let loginManager = LoginManager()
    loginManager.loginBehavior = .native
    loginManager.logIn([ .publicProfile, .userFriends, .email, .custom("user_location"), .custom("user_education_history"), .custom("user_work_history") ], viewController: self) { loginResult in
    }

我从头创建了一个应用程序来测试它,在 GitHub 上分享。仍然是这样。

I created an app from scratch to test it, shared on GitHub. Still does the same.

推荐答案

好的,所以经过几次无用的实验我已经找到了实现我的客户的方法通缉。上述行为是较新版本的FBSDK的结果。一旦我从FBSDK 4.26.0降级到4.24.0(Swift SDK版本没关系),弹出窗口停止显示。因此,如果您遇到同样的问题,并且您的客户(或您)不想要这个弹出窗口,这也可能是您的解决方案。

OK, so after several useless experiments I have been able to find a way to achieve what my client wanted. Aforementioned behavior is the result of a newer version of FBSDK. Once I downgraded from FBSDK 4.26.0 to 4.24.0 (Swift SDK version does not matter), the popup stopped showing. So if you are facing the same problem, and your clients (or you) don't want this popup, this might be a solution for you too.

我不喜欢我认为facebook家伙偶然做到了这一点,这个弹出窗口可以允许一些新的iOS 11功能。但是,我无法区分任何真正的新功能 - 我只注意到如果您想使用本机应用程序或Safari进行登录,新版本不会为您提供选择,而是直接进行Safari登录。但由于这也是我的客户的要求,对我来说,选择是很自然的。

I don't think facebook guys did this by accident, and this popup can allow some new iOS 11 feature. However, I was not able to distinguish any real new functionality - I only noticed that the newer version does not give you a choice if you want to login using native app or safari, but goes directly for the safari login. But since that was a requirement by my client as well, for me the choice was quite natural.

该消息是 SFAuthenticationSession使用的标准消息要求用户访问safari的权限(摘自 docs ):

The message is a standard message used by SFAuthenticationSession to ask the user for permissions to access safari (excerpt from docs):


如果应用程序使用SFAuthenticationSession,则会通过对话框提示用户明确同意,允许应用程序访问网站的Safari中的数据。

If an application uses SFAuthenticationSession, users are prompted by a dialog to give explicit consent, allowing the application to access the website's data in Safari.

这篇关于Facebook登录在iOS 11上显示另一个确认弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆