Facebook SDK登录不适用于iOS 10,Xcode 8上的模拟器 [英] Facebook SDK Login doesn't work on simulator on iOS 10, Xcode 8
问题描述
我尝试通过viewWillAppear
中的Facebook SDK登录系统登录,如下所示:
I try to login via the Facebook SDK login system in viewWillAppear
like so:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if !loggedIn {
if let token = FBSDKAccessToken.current() {
loggedIn = true
self.accessToken = token
} else {
let login = FBSDKLoginButton()
login.center = view.center
view.addSubview(login)
}
}
}
此可以在真实设备上正常运行,但是最近在iOS 10模拟器上,使用Xcode 8和Swift 3似乎失败了.登录按钮正常工作,并提示登录和授权页面,但是在授权/登录后,令牌(FBSDKAccessToken.current()
)仍为nil
.
同样,该问题仅适用于使用iOS 10,Xcode 8和Swift 3的模拟器.
This does work properly on a real device, but lately on the iOS 10 simulator, using Xcode 8 and Swift 3 it seems to fail. The login button works normally and prompts to login and authorization page, but after authorizing/logging in, the token (FBSDKAccessToken.current()
) remains nil
.
Again, the problem only applies on the simulator, using iOS 10, Xcode 8 and Swift 3.
可能是问题所在,如何使它在模拟器上运行?预先感谢.
What could be the problem and how can I get this to work on the simulator? Thanks in advance.
推荐答案
如果它在真实设备上可以正常运行,则表示您已成功集成 Facebook SDK .为了使事情在iOS 10模拟器上正常运行:
转到Project Target
然后转到Capabilities
并切换钥匙串共享 ON .
它将首次要求一个团队.选择一个团队,它将为您添加一个钥匙串组.
If its working fine on a real device, this means that you have successfully integrated the Facebook SDK. In order to make things working on iOS 10 simulator :
Go to the Project Target
and then Capabilities
and switch Keychain Sharing ON.
It will ask for a Team for the first time. Select a team and it will add a Keychain Group for you.
这篇关于Facebook SDK登录不适用于iOS 10,Xcode 8上的模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!