Sharekit for Facebook(Graph API 版本)注销方法未完全注销或取消用户授权
我正在使用 Sharekit 通过 Facebook Graph API 进行 Facebook 共享。我试图找到最新的、最新的代码(github 上的 troppoli 似乎是最新的)。
使用 sharekit 注销 Twitter 可以很好地使用以下行: [SHK logoutOfService:@"SHKTwitter"];但 Facebook 的同一行 [SHK logoutOfService:@"SHKFacebook"] 会产生不同的结果。
当我重新登录时,登录屏幕不显示。相反,屏幕上会显示以下文字:“您已经授权......按确定继续。”然后在屏幕底部显示“登录身份...”和“注销”。但据说用户已经注销了。
更糟糕的是,如果我按“确定”按钮继续,我会收到错误:“操作无法完成。(NSURLErrorDomain 错误 -999。)
我想我可能需要调整 ShareKit 才能完成这项工作,但我有其他人遇到过这种情况吗?
I am using Sharekit for Facebook sharing with the Facebook Graph API. I have tried to find the latest, most up to date code (troppoli on github seems pretty up-to-date).
Using sharekit to log out of Twitter works fine with the line: [SHK logoutOfService:@"SHKTwitter"]; but the same line for Facebook, [SHK logoutOfService:@"SHKFacebook"], yields different results.
When I go to log back in, the login screen does not show. Instead, a screen with the text: "You have already authorized ... Press okay to continue." Then at the bottom of the screen, "Logged in as ..." and "Log out" . But the user is supposedly already logged out.
Even worse, if I press the "Okay" button to continue on, I get the error: "The operation couldn't be completed. (NSURLErrorDomain error -999.)
I think I may need to tweak ShareKit to make this work but I hate to do that. Has anyone else come across this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要确保在 info.plist 中正确设置 URL 方案。在您的 info.plist 中,确保您为 Facebook 设置了 CFBundleURLTypes:
将 {app_id} 替换为您的 Facebook 应用程序 ID。
您还需要在应用程序委托中添加一个处理程序,以便在用户通过 Mobile Safari 进行身份验证后响应回调:
这些更改为我解决了这个问题。
You need to make sure you set up the URL scheme in your info.plist properly. In your info.plist, make sure you have your CFBundleURLTypes set up for Facebook:
Replace {app_id} with your facebook app id.
You also need to add a handler in your app delegate to respond to the callback after the user has authenticated through Mobile Safari:
These changes fixed this issue for me.
我很确定这与新的 Facebook 单点登录 (SSO) 有关。如果用户安装了 Facebook 版本 3.2.3 或更高版本,或者如果设备(或模拟器)上有 Safari,则授权现在在应用程序外部进行。当我找到它时会发布更多内容。
编辑:除了 NSURL 错误之外,这似乎是新 Facebook SSO 的预期行为。用户在“注销”您的应用程序后应该保持伪登录/注销状态,以防他们登录到另一个应用程序等 - 现在都已连接。要真正注销 Facebook(也就是说,以其他人的身份登录等),用户似乎需要单击授权 Web 视图上的注销链接,该链接会在您的应用程序中“注销”Facebook 时显示。我可能是错的,但我对此很确定。
除了上述之外,我确实找到了一种摆脱 NSURL 错误的方法,这使得事情变得更好,更令人愉快。请参阅如何修复 NSURLErrorDomain iPhone 中的错误 -999。
有关新 Facebook SSO 的更多信息:
摘自 Facebook iOS 教程 (特别参见最后一段):
希望这有帮助,如果您发现任何不同之处,请告诉我。
I'm pretty sure this has something to do with the new Facebook Single-Sign-On (SSO). If the user has Facebook version 3.2.3 or greater installed, or if Safari is on the device (or simulator), authorization now takes place OUTSIDE of the app. Will post more as I find it.
EDIT: Apart from the NSURL error, it seems that this is the expected behavior with the new Facebook SSO. Users are supposed to remain in a pseudo-logged in/logged out state after 'logging out' of your app, in case they are logged into another app, etc. - it's all connected now. To really log out of facebook (to say, log in as someone else, etc.) it seems that the user needs to click the logout link on the authorization webview that shows when they are "logged out" of facebook in your app. I could be wrong but I'm pretty sure about this.
Apart from the above, I did find a way to get rid of the NSURL error and this makes things a lot better, and much more palatable. See How Do I Fix NSURLErrorDomain Error -999 in iPhone.
For more on the new Facebook SSO:
Excerpt from Facebook iOS Tutorial (see especially last paragraph):
Hope this helps, let me know if you find anything different.