I use the following code to display a toast after Facebook authentication
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) // check Fb is configured in Settings or not { accountStore = [[ACAccountStore alloc] init]; // you have to retain ACAccountStore ACAccountType *fbAcc = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook]; NSString *key = @"xxxxx"; NSDictionary *dictFB = [NSDictionary dictionaryWithObjectsAndKeys:key,ACFacebookAppIdKey,@[@"email"],ACFacebookPermissionsKey, nil]; [accountStore requestAccessToAccountsWithType:fbAcc options:dictFB completion:^(BOOL granted, NSError *error) { if (granted) { NSLog(@"Perform fb registration"); } else { NSLog(@"Facebook 1"); [[Toast shared] showToast:self.view withText:@"You disabled your app from settings."]; NSLog(@"Facebook 2"); } }]; }
NSLog(@"Facebook 1"); and NSLog(@"Facebook 2"); run and print magazines respectively. However, the toast expression between the two logs is delayed and displayed after 15-20 seconds.
If I put the toast operator [[Toast shared] showToast:self.view withText:@"You disabled your app from settings."]; from the following completion handler:
[accountStore requestAccessToAccountsWithType:fbAcc options:dictFB completion:^(BOOL granted, NSError *error) { }]
It works great and displays a toast in a timely manner, never lingers. Any solution to fix the delay?
source share