2013-04-22 104 views
4

我正在使用FB登錄的應用程序。對於來自Facebook登錄我使用FBGraph,如果用戶在他們的帳戶禁用安全登錄,但如果用戶啓用安全登錄,然後它給下面的消息,它工作正常..facebook安全警告,而用戶​​已啓用安全登錄 - iPhone

enter image description here

這裏是我的代碼用於登錄

self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id]; 

    [fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) 
         andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"]; 

編輯:

從建議從目前的答案,我已經添加下面的代碼在我FBGraph.m但有了這個代碼,我得到令牌爲零。

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ 

    NSLog(@"\n\n\nrequest.URL.relativeString = %@\n\n\n",request.URL.relativeString); 
    if([request.URL.relativeString hasPrefix:@"https://www.facebook.com/connect/login_success.html" ]||[request.URL.relativeString hasPrefix:@"http://www.facebook.com/connect/login_success.html" ]||[request.URL.relativeString hasPrefix:@"http://m.facebook.com/connect/login_success.html" ]) 
    { 
     [self.webView stopLoading]; 
     [[self.webView superview] removeFromSuperview]; 

     //tell our callback function that we're done logging in :) 
     if ((callbackObject != nil) && (callbackSelector != nil)) { 
      [callbackObject performSelector:callbackSelector]; 
     } 

     return NO; 
    } 
    return YES; 
} 

我也改變了

self.redirectUri = @"http://www.facebook.com/connect/login_success.html";

self.redirectUri = @"http://m.facebook.com/connect/login_success.html";

但仍然沒有成功....

請告訴我FB登錄解決方案.....

謝謝...........

回答

2

你應該使用Facebook的官方SDK。

請點擊此處下載 - Facebook SDK

的Facebook

Facebook的SDK 3.8的iOS是一個小更新,增加了XCode 5和 的iOS 7的支持,穩定性修復,自動權限刷新和指定批量請求參數到(FBRequestConnection)的能力。

0

這不是錯誤,而只是來自Facebook的安全警告。我已經在我的申請中解決了這個問題。

入住FbGraph.m下面的方法文件

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ 

    if([request.URL.relativeString hasPrefix:@"https://www.facebook.com/connect/login_success.html" ]) 
     self.webView.hidden=TRUE; 
    return YES; 
} 

檢查它是否是當前存在的文件。如果沒有,那就去吧。

+0

但在這種情況下,令牌是零 – 2013-10-08 09:42:22

1

變更網址:

self.redirectUri = @"http://www.facebook.com/connect/login_success.html"; 

FBGraph.m到

self.redirectUri = @"https://m.facebook.com/connect/login_success.html"; 

和檢查。

+0

一點也不 – 2013-10-08 09:43:02

+0

合作工作的真正的工作感謝的人 – iKambad 2013-10-08 11:23:40

+0

的行爲沒有影響。不工作 – 2013-10-15 10:13:21