I tried setting up Google+ to log in to iOS using Google+ to log in to iOS . I also used to follow the Google Planet Getting Started Guide .
My code is as follows:
- (void)didTapSignIn {
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGoogleUserEmail = YES;
signIn.clientID = PTCGoogleClientID;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
signIn.attemptSSO = YES;
signIn.delegate = self;
[signIn authenticate];
}
But instead of having a Google login dialog, I got this error message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: state)'
Learn more about the crash log:
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
Can someone tell me what is wrong with my code? Thank.
source
share