2013-04-22 103 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