0

When linking my iOS with Facebook through Parse with the following code I get the following error:

+[PFDateFormatter sharedFormatter]: unrecognized selector sent to class 0x1001f31d0

Unsure of how to handle this, and this error executes when the following block is called:

[PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {
        [_activityIndicator stopAnimating]; // Hide loading indicator

        if (!user) {
            NSString *errorMessage = nil;
            if (!error) {
                NSLog(@"Uh oh. The user cancelled the Facebook login.");
                errorMessage = @"Uh oh. The user cancelled the Facebook login.";
            } else {
                NSLog(@"Uh oh. An error occurred: %@", error);
                errorMessage = [error localizedDescription];
            }
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log In Error"
                                                            message:errorMessage
                                                           delegate:nil
                                                  cancelButtonTitle:nil
                                                  otherButtonTitles:@"Dismiss", nil];
            [alert show];
        } else {
            if (user.isNew) {
                NSLog(@"User with facebook signed up and logged in!");
            } else {
                NSLog(@"User with facebook logged in!");
            }
            [self.navigationController popToRootViewControllerAnimated:YES];
        }
    }];
Larme
  • 24,190
  • 6
  • 51
  • 81
  • Which line exactly does cause the crash? It doesn't seems to be here. Maybe the last one which will call `sharedFormatter` when you pop to root VC. – Larme Feb 04 '15 at 09:29
  • It doesn't crash, it simply doesn't execute the block. Even with the code in the block commented out, it performs the same error. – ralphie6120 Feb 04 '15 at 09:34
  • A `unrecognized selector sent to class` should cause a crash. It's a well known issue and the error is quite explicit. If by commenting the code there, it could means that the issue is elsewhere. – Larme Feb 04 '15 at 09:37
  • Parse has a tutorial project on this which I have downloaded and executed successfully, however, with identical code placed within my current app I get the above error. – ralphie6120 Feb 04 '15 at 09:47
  • Have you made sure to call `[PFFacebookUtils initializeFacebook];` in your AppDelegate? – mbm29414 Feb 04 '15 at 14:26
  • Yes, initializeFacebook is called in the AppDelegate – ralphie6120 Feb 04 '15 at 15:00
  • possible duplicate of [How can I debug 'unrecognized selector sent to instance' error](http://stackoverflow.com/questions/25853947/how-can-i-debug-unrecognized-selector-sent-to-instance-error) – Hot Licks Mar 02 '15 at 23:37

1 Answers1

0

I fixed this by removing all the Parse and Facebook frameworks from my project, and then adding this to my podfile:

pod 'Facebook-iOS-SDK' pod 'Parse' pod 'ParseFacebookUtils'

and reinstalling my podfile. For whatever reason, something is missing from the Parse or Facebook frameworks downloaded from the website. The podfiles fixed the issue for me.

jfoos
  • 1