I was following Facebook's own tutorial for FB login in iOS (Objective-C) but every time I log in - after the initial permission authorization screen - I'm getting the infamous "You have already authorized this app" webview.
I've read a ton of posts but I haven't been able to sort it out, hence the (re)post. I find this rather odd because the app has absolutely nothing except the boilerplate login code. This behaviour happens in both Simulator and real devices.
This app is for iOS 9.0 and I am using FBSDK 4.7.1 (installed via CocoaPods):
pod 'FBSDKLoginKit', '~> 4.6'
The code itself is pretty boilerplate stuff, here's my AppDelegate.m:
#import "AppDelegate.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
return YES;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
@end
and my ViewController.m:
#import "ViewController.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.readPermissions = @[@"public_profile", @"email", @"user_friends"];
[loginButton setLoginBehavior:FBSDKLoginBehaviorSystemAccount]; // No difference
loginButton.center = self.view.center;
[self.view addSubview:loginButton];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
And a screenshot of the Info.plist:
Finally, I'm also getting these two errors in the console:
2015-11-24 11:50:42.855 lixo[26941:389756] -canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
2015-11-24 11:50:42.860 lixo[26941:389756] -canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
Although from what I've read this can be safely ignored if LSApplicationQueriesSchemes is set in the Info.plist.
Any ideas how to avoid this?