I'm following this tutorial to integrate facebook login with messenger. When I'm compiling the first part of the code, I receive the error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must initialize PFFacebookUtils with a call to +initializeFacebookWithApplicationLaunchOptions'
I came across multiple threads including this one, however this was fixed in the new version I'm using already and thus can't be applied to fix my problem.
I hooked up a button that runs the tutorial code:
- (IBAction)loginWithFacebook:(id)sender
{
// Set permissions required from the facebook user account
NSArray *permissionsArray = @[ @"user_about_me", @"user_relationships", @"user_birthday", @"user_location"];
// Login PFUser using Facebook
[PFFacebookUtils logInInBackgroundWithReadPermissions:permissionsArray block:^(PFUser *user, NSError *error)
{
if (!user)
{
NSLog(@"Uh oh. The user cancelled the Facebook login.");
}
else if (user.isNew)
{
NSLog(@"User signed up and logged in through Facebook!");
}
else
{
NSLog(@"User logged in through Facebook!");
}
}];
}
Also, my AppDelegate.m has:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}
That guide doesn't mention all of the required code to make it work. Parse does have more info in their iOS Guide. To resolve this issue specifically, in your
didFinishLaunchingWithOptions
method, replace yourFBSDKApplicationDelegate
call with the following: