如何在iOS 10上使用Facebook iOS SDK [英] How to use Facebook iOS SDK on iOS 10

查看:872
本文介绍了如何在iOS 10上使用Facebook iOS SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Xcode 8构建一个使用Swift 3登录Facebook的应用。当我切换回iOS模拟器9.3时,它可以工作。在iOS 10中,我收到此错误:

 fbauth2:/操作无法完成。(OSStatus错误-10814。)

 可选(错误域= com.facebook.sdk.login代码= 308(null))

任何人都有此解决方案吗?



注1:



调试后,这个问题是FBSDK无法更新 expect_challange 。函数 SecItemUpdate security.framework 内部无效。这是IOS 10的问题

解决方案

错误OSStatus -10814 canOpenURL:



如果您使用 Xamarin (阅读此链接了解更多信息,感谢@dynamokaj):


请确认y你在权利中启用钥匙串访问,并且
也选择模拟器(调试)构建的权利。默认情况下,
未设置。



I am trying to use Xcode 8 to build a app with Facebook login using Swift 3. When I switch back iOS Simulator 9.3, it works. In iOS 10, I receive this error:

""fbauth2:/" The operation couldn’t be completed. (OSStatus error -10814.)"

and

Optional(Error Domain=com.facebook.sdk.login Code=308 "(null)")

Anyone have solution for this?

Note 1 :

After debugging, this problem is FBSDK cant update expect_challange. Function SecItemUpdate inside security.framework not work. This is a problem of IOS 10

解决方案

Error OSStatus -10814 occures when canOpenURL: can't find any application, that can open this URL (actually, Facebook trying to find their application by calling canOpenURL: with argument "fbauth2:/"). Printing happens inside of function, so you can't do anything with that. But if you will run your application on device with installed Facebook app, you will not see this error.

Error 308 occures because of the situation, when value, stored in keychain is not equal to value, that is stored in facebook completion parameters (for more information you can check -[FBSDKLoginManager completeAuthentication:expectChallenge:]).

It happens because Apple changed the way of working with keychain in iOS 10. To fix this issue you simply should go to Targets->Capabilities and enable keychain sharing (it enables access to keychain for your app):

If you are using Xamarin (read this link for more information, thanks @dynamokaj):

Just make sure you enable the keychain access in Entitlements and select the entitlements for Simulator (Debug) builds too. By default this is not set.

这篇关于如何在iOS 10上使用Facebook iOS SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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