2011-06-10 78 views
3

我正在開發一個iPhone應用程序,處理Facebook。我正在使用最新的SDK facebook-facebook-ios-sdk-cf1c2c3(SDK 2.0)允許用戶使用OAuth登錄到Facebook帳戶。Facebook的OAuth登錄問題與Facebook SDK 2.0

用戶可以在設備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中的可執行文件。但是,我也遇到了應用商店可執行文件的問題。

我該如何解決這個問題?

感謝和問候, 迪帕

回答

10

這不是SDK問題。設備(3GS)中設置的日期和時間不正確。

+0

感謝您的回答!其實我試圖弄清楚爲什麼我的朋友的iPhone 3G不會登錄Facebook。它產生了這個1202錯誤。谷歌搜索沒有幫助,但stackoverflow做到了!謝謝! +1 – gonzobrains 2012-05-04 16:52:22