ios – GPPSignIn与NSInvalidArgumentException崩溃

我尝试使用
Google+ Sign-In for iOS指南设置Google登录iOS版.以前我也跟着
Google Platform Getting Started指南.

我的代码如下:

- (void)didTapSignIn {
    GPPSignIn *signIn = [GPPSignIn sharedInstance];
    signIn.shouldFetchGoogleUserEmail = YES;
    signIn.clientID = PTCGoogleClientID;
    signIn.scopes = @[ kGTLAuthScopePlusLogin ];
    signIn.attemptSSO = YES;
    signIn.delegate = self;
    [signIn authenticate];
}

但是,我没有使用Google登录对话框,而是收到以下错误消息:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: state)'

崩溃日志的更多细节:

0   CoreFoundation                      0x03654916 __exceptionPreprocess + 182
1   libobjc.A.dylib                     0x032f28d9 objc_exception_throw + 44
2   CoreFoundation                      0x035450bc -[__NSDictionaryM setObject:forKey:] + 940
3   MyApp                               0x0015172c -[GPPSignIn oauth2URLWithParams:] + 450
4   MyApp                               0x001518f4 -[GPPSignIn doOAuthLoginWithParams:] + 107
5   MyApp                               0x00151d24 -[GPPSignIn authenticateInteractivelyWithParams:] + 91
6   MyApp                               0x00151f96 -[GPPSignIn authenticateMaybeInteractively:withParams:] + 610
7   MyApp                               0x0014ecb1 -[GPPSignIn authenticate] + 49
8   MyApp                               0x0001c8e4 -[MyAppController tapGoogleLogin:] + 132
9   libobjc.A.dylib                     0x033057bf -[NSObject performSelector:withObject:withObject:] + 84
10  UIKit                               0x016dc1fe -[UIApplication sendAction:to:from:forEvent:] + 99
11  UIKit                               0x016dc190 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
12  UIKit                               0x01804786 -[UIControl sendAction:to:forEvent:] + 69
13  UIKit                               0x01804ba3 -[UIControl _sendActionsForEvents:withEvent:] + 598
14  UIKit                               0x01803e0d -[UIControl touchesEnded:withEvent:] + 660
15  UIKit                               0x0172814a -[UIWindow _sendTouchesForEvent:] + 874
16  UIKit                               0x01728c25 -[UIWindow sendEvent:] + 791
17  UIKit                               0x016f30a5 -[UIApplication sendEvent:] + 242
18  UIKit                               0x0170075e _UIApplicationHandleEventFromQueueEvent + 13892
19  UIKit                               0x016d6b64 _UIApplicationHandleEventQueue + 1561
20  CoreFoundation                      0x0357930f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
21  CoreFoundation                      0x0356dc99 __CFRunLoopDoSources0 + 249
22  CoreFoundation                      0x0356d1f8 __CFRunLoopRun + 952
23  CoreFoundation                      0x0356cb7b CFRunLoopRunSpecific + 443
24  CoreFoundation                      0x0356c9ab CFRunLoopRunInMode + 123
25  GraphicsServices                    0x04ded500 GSEventRunModal + 192
26  GraphicsServices                    0x04ded33d GSEventRun + 104
27  UIKit                               0x016dadee UIApplicationMain + 3727
28  MyApp                               0x00026cad main + 141
29  libdyld.dylib                       0x03aeeac5 start + 1
30  ???                                 0x00000001 0x0 + 1

有人能指出我的代码有什么问题吗?谢谢.

最佳答案 刚刚下载的是Apple于6月17日发布的XCode 6 Beta 2.然后,我重试了代码,它运行正常.

点赞