iOS上的新Facebook登录重定向流程

问题描述:

从iOS 11开始,我在使用FBSDKLoginKit和FBSDKCoreKit时看到新的登录流程。我意识到苹果最近对应用程序如何相互交流的改变:Facebook凭据意味着我们首先必须在身份验证流程中通过Safari浏览器...但出于某种原因,我看到了下面的警报对话框(请参阅第一和第第二次截图),即使在其他具有Facebook登录功能的应用程序中,我也可以直接访问facebook.com,然后通过本地Facebook应用程序通过电子邮件/密码登录(请参阅第二次截图)。iOS上的新Facebook登录重定向流程

有谁知道为什么我在我的应用程序上看到这个流程,但在几乎所有其他应用程序中都看到了不同的流程,我遵循https://developers.facebook.com/docs/facebook-login/ios上列出的流程,所以我几乎被困住了。提前致谢。

Login screen for FB iOS SDK enter image description here enter image description here

+0

你试过改变'loginBehavior'吗?请参阅https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h#L72该警报是iOS 11的一部分'SFAuthenticationSession'验证流程 – nathan

+0

dang,@nathan!谢谢。从'FBSDKLoginBehaviorSystemNative'切换到'FBSDKLoginBehaviorSystemBrowser'或'FBSDKLoginBehaviorSystemAccount'解决了“忘记使用Facebook应用程序登录”按钮 - 但是'SFAuthenticationSession'警报仍然存在。切换到“FBSDKLoginBehaviorSystemWeb”摆脱了“SFAuthenticationSession”警报,但我们仍然缺少“使用Facebook应用程序登录”按钮。有没有办法没有警报,但有“使用Facebook应用程序登录”按钮(类似于呼吸器应用程序)? – maxhs

+0

啊,我看到你已经在其他地方回答了这个问题,@nathan https://*.com/questions/45858774/ios-11-facebook-signin-is-showing-an-initial-system-alert – maxhs

你可以尝试改变登录管理器的loginBehavior。见https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h#L72。该警报是iOS 11的SFAuthenticationSession授权流程的一部分。

/** 
    This is the default behavior, and indicates logging in through the native 
Facebook app may be used. The SDK may still use Safari instead. 
*/ 
case native 
/** 
    Attempts log in through the Safari or SFSafariViewController, if available. 
*/ 
case browser 
/** 
    Attempts log in through the Facebook account currently signed in through 
the device Settings. 
@note If the account is not available to the app (either not configured by user or 
as determined by the SDK) this behavior falls back to \c .native. 
*/ 
case systemAccount 
/** 
    Attempts log in through a modal \c UIWebView pop up 
@note This behavior is only available to certain types of apps. Please check the Facebook 
Platform Policy to verify your app meets the restrictions. 
*/ 
case web 

这是一个预期的行为,苹果& Facebook上向我证实。这是SafariViewController身份验证的实现和流程,它也由Apple记录(系统警报)&您发布的第三个屏幕截图很可能是使用旧版Facebook SDK的应用程序。请结帐this post我几周前用与您描述的相同用户体验开设的,然后您会发现更多意见&链接到正确的文档。除非降级FB版本,否则在代码中无法执行任何操作以防止出现系统警报。