Facebook SDK 2.0的Facebook OAuth登录问题

时间:2011-06-10 12:47:54

标签: iphone facebook sdk login oauth

我正在开发一款处理Facebook的iPhone应用程序。我使用最新的SDK facebook-facebook-ios-sdk-cf1c2c3(SDK 2.0)允许用户使用OAuth登录Facebook帐户。

用户可以在设备iPod Touch(4.3.1)中毫无问题地登录。但在iPhone 3GS中我收到以下错误:

Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201cm.facebook.com\u201d which could put your confidential information at risk." UserInfo=0x1b8350 {NSErrorFailingURLStringKey=https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fbconnect://success&sdk=2&scope=read_stream,publish_stream&client_id=<APP_ID>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fbconnect://success&sdk=2&scope=read_stream,publish_stream&client_id=<APP_ID>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201cm.facebook.com\u201d which could put your confidential information at risk., NSUnderlyingError=0x1b83a0 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201cm.facebook.com\u201d which could put your confidential information at risk.", NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x1be310>}


I extracted the URL from the FBLoginDailog and tried loading it in iPhone -> Safari. It redirects to the following URL and allows the user to login:

http://m.facebook.com/login.php?app_id=<APP_ID>&sdk=2&cancel=fbconnect://success?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.&fbconnect=1&next=https://www.facebook.com/connect/uiserver.php?method=permissions.request&app_id=<APP_ID>&display=touch&redirect_uri=fbconnect;//success&sdk=2&type=user_agent&fbconnect=1&perms=read_stream,publish_stream&from_login=1&rcount=1

另外,我从链接中找到以下解决方法: https://github.com/facebook/facebook-ios-sdk/issues/139

但是,链接还提到不要将它用于App Store可执行文件。但是,我也遇到了app store可执行文件的问题。

我该如何解决这个问题?

谢谢和问候, 迪帕

1 个答案:

答案 0 :(得分:10)

这不是SDK问题。设备(3GS)中设置的日期和时间不合适。