facebook Security Warning while user has enabled s

2019-01-15 15:59发布

I am working on an application which uses FB login. For login from faceBook I am using FBGraph and it works fine if users have disabled secure login in their account, but if user enables the secure login then it gives following message..

enter image description here

Here is my code i used for login

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"];

EDIT:

From suggestions from current answers, I have added following code in my FBGraph.m But with this code i am getting token nil.

- (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;
}

I have also changed

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

To

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

But still no success....

Please tell me the solution for FB Login.....

Thanks...........

3条回答
闹够了就滚
2楼-- · 2019-01-15 16:30

This is not an error , but just a security warning from Facebook. And I have resolved it in my application to escape from this.

Check the below method in FbGraph.m file

- (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;
}

check if it's currently present in file. If not then go with it.

查看更多
干净又极端
3楼-- · 2019-01-15 16:48

You should use Facebook's official SDK.

Download it from here - Facebook SDK

Facebook says

The Facebook SDK 3.8 for iOS is a minor update that adds XCode 5 and iOS 7 support, stability fixes, automatic permissions refresh and the ability to specify batch request parameters to (FBRequestConnection).

查看更多
做自己的国王
4楼-- · 2019-01-15 16:50

Change url :

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

FBGraph.m to

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

and check.

查看更多
登录 后发表回答