简体   繁体   English

更改权限后无法在Cordova iOS上使用Facebook SDK登录

[英]Can't login with Facebook SDK on cordova iOS after changing permissions

I'm using Cordova latest version with this plugin https://github.com/jeduan/cordova-plugin-facebook4 ... In the first version, I was getting permission for only: 我正在使用带有此插件的最新版本的Cordova https://github.com/jeduan/cordova-plugin-facebook4 ...在第一个版本中,我仅获得许可:

id,email,birthday

And in the 2nd version, I am getting permission for: 在第二版中,我获得了以下方面的许可:

id,email,birthday,gender,first_name,last_name

which causes the following error: 导致以下错误:

domain=com.facebook.sdk.login code=304

But if I removed the app and re-installed it, it works fine! 但是,如果我删除了该应用程序并重新安装,它就可以正常工作!

So, what should I do now? 那么,我现在该怎么办? the app in production, and all users can't login, and it is really hard to ask all users to remove the app and re-install it! 该应用程序正在生产中,并且所有用户都无法登录,这真的很难要求所有用户删除该应用程序并重新安装! any idea to release another version with a patch to fix this issue? 有什么想法发布带有补丁的另一个版本来解决此问题?

I think there is a solution here: ios facebook sdk 4.0 login error code 304 , but I'm not a good Objective C developer to know how to implement it in the plugin! 我认为这里有一个解决方案: ios facebook sdk 4.0登录错误代码304 ,但是我不是一个很好的Objective C开发人员,不知道如何在插件中实现它!

The issue is because the cordova facebook plugin call facebookConnectPlugin.getLoginStatus() caches the FB response. 问题是因为cordova facebook插件调用facebookConnectPlugin.getLoginStatus()缓存了FB响应。 It doesn't allow us to force a server trip in that call (whereas in the FB Javascript SDK it does). 它不允许我们在该调用中强制服务器跳闸(而在FB Javascript SDK中可以)。

I resolve the issue by calling facebookConnectPlugin.login() when I get 304. That forces a server trip to reload the FB permission upon a fresh login. 当我获得304时,我通过调用facebookConnectPlugin.login()解决了该问题。这将强制服务器运行以在重新登录后重新加载FB权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM