Take the 2-minute tour ×

I am using FBConnect to log in in Facebook but as soon as I tap on the my app Facebook button safari comes up in front and after 1 second automatically hide (go back again). this is happening again and again.

In the Facebook.m I have set safariAuth:YES

- (void)authorize:(NSArray *)permissions {
    self.permissions = permissions;
    [self authorizeWithFBAppAuth:YES **safariAuth:YES**];

- (BOOL)handleOpenURL:(NSURL *)url {
        return NO;

    NSString *query = [url fragment];

    // the fragment is missing.
    if (!query) {
        query = [url query];

    NSDictionary *params = [self parseURLParams:query];
    NSString *accessToken = [params objectForKey:@"access_token"];

    // If the URL doesn't contain the access token, an error has occurred.
    if (!accessToken) {
        NSString *errorReason = [params objectForKey:@"error"];

        // If the error response indicates that we should try again using Safari, open
        // the authorization dialog in Safari.
        if (errorReason && [errorReason isEqualToString:@"service_disabled_use_browser"]) {
            [self authorizeWithFBAppAuth:NO **safariAuth:YES**];
            return YES;

        // If the error response indicates that we should try the authorization flow
        // in an inline dialog, do that.
        if (errorReason && [errorReason isEqualToString:@"service_disabled"]) {
            [self authorizeWithFBAppAuth:NO safariAuth:YES];
            return YES;

        // The facebook app may return an error_code parameter in case it
        // encounters a UIWebViewDelegate error. This should not be treated
        // as a cancel.
        NSString *errorCode = [params objectForKey:@"error_code"];

        BOOL userDidCancel =
        !errorCode && (!errorReason || [errorReason isEqualToString:@"access_denied"]);
        [self fbDialogNotLogin:userDidCancel];
        return YES;

    // We have an access token, so parse the expiration date.
    NSString *expTime = [params objectForKey:@"expires_in"];
    NSDate *expirationDate = [NSDate distantFuture];
    if (expTime != nil) {
        int expVal = [expTime intValue];
        if (expVal != 0) {
            expirationDate = [NSDate dateWithTimeIntervalSinceNow:expVal];

    [self fbDialogLogin:accessToken expirationDate:expirationDate];
    return YES;

Can any one help me out for this ? why this is happening ?

Thank you.

share|improve this question
You have a 0% acceptance rate. Please improve it by accepting answers to your questions where possible. Click this link for more information about :Acceptance Rate. –  Claric PWI Aug 23 '12 at 12:48
Thank you for the information. as I am new here I was not aware about these things. I have accepted the answers by up voted. I will take care of this from now onwards. –  jattt.... Aug 23 '12 at 12:57
We are here to help So np and sure wc to SO :) –  Claric PWI Aug 23 '12 at 13:02
It's not just vote up the answer have to accept it. Just visit the link I have provided in my first comment Click on Acceptance Rate in my first comment the last two words and it will show you how to accept any answer :) –  Claric PWI Aug 24 '12 at 5:15
ok I have got.Thank you for the information. –  jattt.... Aug 24 '12 at 14:04
add comment


Your Answer



Browse other questions tagged or ask your own question.