[英]Error with integrating FB SDK (Version 4.7.0) with iOS 9 in XCode 7.0.1: canOpenURL: failed for URL: “fbauth2:/”
I follow the latest instruction at here for integrating FBSDK (Version 4.7.0 downloaded) with my latest XCode. 我按照此处的最新说明将FBSDK(下载的版本4.7.0)与最新的XCode集成在一起。 I am pretty sure I have configured the following in info.plist (I only need these for Version 4.7.0 ):
我很确定我已经在info.plist中配置了以下内容(我仅在4.7.0版中需要这些内容):
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
and copied everything as Facebook provided in my Facebook Development account. 并复制了我在Facebook开发帐户中提供的所有内容。 However, when I tried to login with the Facebook Login Button, I got this error:
但是,当我尝试使用Facebook登录按钮登录时,出现此错误:
canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
When I see this error, my app just stuck and does not seem to have been authenticated even if I have clicked 'OK' in Safari. 当我看到此错误时,我的应用只是卡住了,即使我在Safari中单击了“确定”也似乎未通过身份验证。 I also saw the following as explained by Facebook, but it doesn't make sense to me, as my app remains stuck with this error message.
我还看到了Facebook所解释的以下内容,但对我来说这没有意义,因为我的应用程序始终停留在此错误消息中。
In iOS 9, the app switches can prompt the user with a confirmation dialog. The SDK will try to minimize the frequency of this by choosing the best dialog available (such as SafariViewController), but this is by design in iOS 9.
I know this may sound silly, but I found the solution, which is not related to the settings in my .plist
file. 我知道这听起来很愚蠢,但是我找到了解决方案,该解决方案与
.plist
文件中的设置无关。 I put the two following functions in my App Delegate, everything works correctly despite of the above warning for fbauth2 我将以下两个函数放入我的App Delegate中,尽管上面出现了fbauth2警告,但一切正常
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
// return FBAppCall.handleOpenURL(url, sourceApplication:sourceApplication, session:PFFacebookUtils.session())
return FBSDKApplicationDelegate.sharedInstance().application(application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation)
}
//Make sure it isn't already declared in the app delegate (possible redefinition of func error)
func applicationDidBecomeActive(application: UIApplication) {
FBSDKAppEvents.activateApp()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.