facebook Security Warning while user has enabled secure login - iPhone

Nirav Gadhiya picture Nirav Gadhiya · Apr 22, 2013 · Viewed 12.2k times · Source

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...........

Answer

Akshit Zaveri picture Akshit Zaveri · Oct 15, 2013

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).