Parse和Facebook - PFUser logInWithAuthType无法识别的选择器错误

时间:2014-10-21 17:56:36

标签: ios objective-c parse-platform facebook-ios-sdk

我在使用Parse对Facebook进行身份验证时遇到问题。我的应用程序将运行正常,直到我点击登录到facebook按钮,并抛出以下错误:

2014-10-21 12:42:20.047 beacon-iphone[35352:15965138] +[PFUser logInWithAuthType:block:]: unrecognized selector sent to class 0x1101f0640
2014-10-21 12:42:20.050 beacon-iphone[35352:15965138] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[PFUser logInWithAuthType:block:]: unrecognized selector sent to class 0x1101f0640'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000011349e3f5 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000113137bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x00000001134a540d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00000001133fd7fc ___forwarding___ + 988
    4   CoreFoundation                      0x00000001133fd398 _CF_forwarding_prep_0 + 120
    5   beacon-iphone                       0x000000010ff4752e +[PFFacebookUtils logInWithPermissions:block:] + 159
    6   beacon-iphone                       0x000000010fd39374 -[ViewController loginButtonTouchHandler:] + 228
    7   UIKit                               0x00000001119f69ee -[UIApplication sendAction:to:from:forEvent:] + 75
    8   UIKit                               0x0000000111afcbd0 -[UIControl _sendActionsForEvents:withEvent:] + 467
    9   UIKit                               0x0000000111afbf9f -[UIControl touchesEnded:withEvent:] + 522
    10  UIKit                               0x0000000111a3c3b8 -[UIWindow _sendTouchesForEvent:] + 735
    11  UIKit                               0x0000000111a3cce3 -[UIWindow sendEvent:] + 683
    12  UIKit                               0x0000000111a09ae1 -[UIApplication sendEvent:] + 246
    13  UIKit                               0x0000000111a16bad _UIApplicationHandleEventFromQueueEvent + 17370
    14  UIKit                               0x00000001119f2233 _UIApplicationHandleEventQueue + 1961
    15  CoreFoundation                      0x00000001133d3ad1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    16  CoreFoundation                      0x00000001133c999d __CFRunLoopDoSources0 + 269
    17  CoreFoundation                      0x00000001133c8fd4 __CFRunLoopRun + 868
    18  CoreFoundation                      0x00000001133c8a06 CFRunLoopRunSpecific + 470
    19  GraphicsServices                    0x00000001143219f0 GSEventRunModal + 161
    20  UIKit                               0x00000001119f5550 UIApplicationMain + 1282
    21  beacon-iphone                       0x000000010fd3af63 main + 115
    22  libdyld.dylib                       0x00000001139ca145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

阅读完消息后,看起来错误来自PFFacebookUtils loginWithPermissions方法:

- (IBAction)loginButtonTouchHandler:(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 logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {

        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!");
            }
        }
    }];
}

然而,这是Parse所记录的香草登录。有什么建议吗?

更新 在进一步分析之后,我注意到只有当Parse从1.4.1升级到1.4.2

时才会出现此错误

1 个答案:

答案 0 :(得分:1)

您必须在ParseFacebookUtils 1.4.1中使用Parse 1.4.2。执行pod update,它会将您的ParseFacebookUtils更新为1.4.2。