Reputation: 5259
I am still using Objective-C in my project, since it is a legacy one. I was using Parse before and now I am trying to add FB integration. I managed to make everything compile - these are what I have installed via CocoaPods.
Using Bolts (1.2.0)
Installing FBSDKCoreKit (4.3.0)
Installing FBSDKLoginKit (4.3.0)
Using Parse (1.7.5)
Installing ParseFacebookUtilsV4 (1.7.5)
Here is my code.
FirstViewController
-(void) viewDidAppear:(BOOL)animated
{
// Do any additional setup after loading the view, typically from a nib.
if (![PFUser currentUser] || // Check if user is cached
![PFFacebookUtils isLinkedWithUser:[PFUser currentUser]]) { // Check if user is linked to Facebook
PFLogInViewController *logInController = [[PFLogInViewController alloc] init];
logInController.fields = (PFLogInFieldsUsernameAndPassword
| PFLogInFieldsFacebook
| PFLogInFieldsDismissButton);
[self presentViewController:logInController animated:YES completion:nil];
[self presentViewController:loginViewController animated:YES completion:NULL];
} else {
NSLog(@"User is cached and showing content.");
}
}
When the view shows up and I click on the log-in with Facebook, I have this error.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must initialize PFFacebookUtils with a call to +initializeFacebookWithApplicationLaunchOptions'
If I add this on my AppDelegate,
[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions];
I get a compilation issue - no known class.
Based on this, I should add a temporary hack in the PFFacebookUtils, BUT the method initializeFacebookWithApplicationLaunchOptions
does not exist in that file.
I also tried adding this in my AppDelegate.
[PFFacebookUtils initializeFacebook];
In that case, the error is :
+[PFFacebookUtils initializeFacebook]: unrecognized selector sent to class 0x10024f420
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[PFFacebookUtils initializeFacebook]: unrecognized selector sent to class 0x10024f420'
Any ideas/solutions?
Upvotes: 1
Views: 929
Reputation: 1
I had the same problem, so I tried to delete the Parse library and use Cocoapods to install the library again, then it works! I didn't change any code, and just add the following line to my Podfile:
pod 'Parse', '~> 1.7'
pod 'ParseFacebookUtilsV4', '~> 1.7'
I don't know why, but it works.
Upvotes: 0
Reputation: 2268
Make sure you're importing V4 of the framework
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
It's a subtle, but VERY important difference, and it will, for some reason, compile just importing
#import <ParseFacebookUtils/PFFacebookUtils.h>
especially if you just switched from regular FB Utils.
Upvotes: 2