iOS-Facebook登录错误-建立URL时发生未知错误(com.facebook.sdk.core错误3) [英] iOS - Facebook Login Error - Unknown Error building URL (com.facebook.sdk.core error 3)
问题描述
我在为iOS 8及更高版本开发的iOS应用程序中使用Facebook登录名. (正在使用最新的Facebook SDK)
I am using Facebook login for my iOS app being developed for iOS 8 and onwards. (Latest Facebook SDK is being used)
我已经遵循了Facebook官方指南中描述的所有基本步骤.但是,当我单击登录按钮时,出现以下错误:
I have followed all the essential steps described by the Facebook official guide. However, when I click the login button it gives me the following error:
构建URL时发生未知错误(com.facebook.sdk.core错误3)
Unknown Error building URL (com.facebook.sdk.core error 3)
我已经检查过,看可能做错了什么,但是一切似乎都按照指南进行,而且我在这里呆了一天.
I have checked, to look what I might have done wrong, but everything seems as per guide, and I have been stuck here for a day.
FB登录代表的代码:
Code for FB Login Delegate:
class FBLoginDelegate: NSObject, FBSDKLoginButtonDelegate {
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!){
if(error == nil){
print("Logged In from Btn")
}else{
print("Error: \(error.localizedDescription)") //Here it gives the error
}
}
}
FB登录按钮的代码:
Code for FB login button:
var fbLoginBtnDelegate = FBLoginDelegate()
let fbBtnWidth = self.view.bounds.width - (self.fbContainerLeftConstraint.constant + self.fbContainerRightConstraint.constant)
let fbLoginButton = FBSDKLoginButton(frame: CGRectMake(0,0,fbBtnWidth,self.fbButtonContainer.bounds.size.height))
self.fbButtonContainer.addSubview(fbLoginButton)
fbLoginButton.readPermissions = ["public_profile", "user_friends", "email", "user_birthday"]
fbLoginButton.delegate = fbLoginBtnDelegate
推荐答案
如果将Facebook iOS SDK升级到版本4.39.0,则存在一个导致此错误的错误.降级到4.38.1将帮助您解决此问题.确保同时降级FBSDKCoreKit和FBSDKLoginKit.
If you upgraded the Facebook iOS SDK to version 4.39.0, there is a bug that causes this error. Downgrade to 4.38.1 will help you solve this problem. Be sure to downgrade both FBSDKCoreKit and FBSDKLoginKit.
pod 'FBSDKCoreKit', '~> 4.38.0'
pod 'FBSDKLoginKit', '~> 4.38.0'
请确保清理构建文件夹并重新构建SDK.
Be sure to clean the build folder and re-build the SDK.
更新:此错误已在4.39.1 SDK版本中修复. https://developers.facebook.com/docs/ios/change-log- 4x/
update: This bug has been fixed in 4.39.1 SDK release. https://developers.facebook.com/docs/ios/change-log-4x/
这篇关于iOS-Facebook登录错误-建立URL时发生未知错误(com.facebook.sdk.core错误3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!