From the Crashlytics
, we are receiving a large amount of crash reports in the Google Login process. The crash report is as follows:
Fatal Exception: NSInvalidArgumentException
uiDelegate must either be a |UIViewController| or implement the |signIn:presentViewController:| and |signIn:dismissViewController:| methods from |GIDSignInUIDelegate|.
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x1837f2db0 __exceptionPreprocess
1 libobjc.A.dylib 0x182e57f80 objc_exception_throw
2 CoreFoundation 0x1837f2cf8 -[NSException initWithCoder:]
3 Hello English 0x100583d18 -[GIDSignIn assertValidUIDelegate] (GIDSignIn.m:512)
4 Hello English 0x1005861dc -[GIDSignIn signInWithOptions:] (GIDSignIn.m:961)
5 Hello English 0x10058a0e4 -[GIDSignInButton pressed] (GIDSignInButton.m:385)
6 UIKit 0x188988be8 -[UIApplication sendAction:to:from:forEvent:]
7 UIKit 0x188988b64 -[UIControl sendAction:to:forEvent:]
8 UIKit 0x188970870 -[UIControl _sendActionsForEvents:withEvent:]
9 UIKit 0x188988454 -[UIControl touchesEnded:withEvent:]
10 UIKit 0x188988084 -[UIWindow _sendTouchesForEvent:]
11 UIKit 0x188980c20 -[UIWindow sendEvent:]
12 UIKit 0x18895104c -[UIApplication sendEvent:]
13 UIKit 0x18894f628 _UIApplicationHandleEventQueue
14 CoreFoundation 0x1837a909c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
15 CoreFoundation 0x1837a8b30 __CFRunLoopDoSources0
16 CoreFoundation 0x1837a6830 __CFRunLoopRun
17 CoreFoundation 0x1836d0c50 CFRunLoopRunSpecific
18 GraphicsServices 0x184fb8088 GSEventRunModal
19 UIKit 0x1889ba088 UIApplicationMain
20 Hello English 0x10029b2cc main (AppDelegate.swift:26)
21 libdispatch.dylib 0x18326e8b8 (Missing)
We've tried so far:
GIDSignIn.sharedInstance().uiDelegate = self
from viewDidLoad()
to viewDidAppear(animated: Bool)
GIDSignInUIDelegate
with no success.UIViewController
, but now it is and the crashes are still counting.UIButton
, so we thought that might be cause (though illogical, but we tried) of crash; we changed it to GIDSignInButton
, but no reduction in crash-count.For now we have removed the Google Login
process, but it is not the solution. And strange thing is that we are unable to reproduce this crash at our end; we are only getting these crashes on Crashlytics
.
So Anyone with any solution ?
you need to write these lines in viewWillAppear
method of UIViewController
.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
GIDSignIn.sharedInstance().uiDelegate = self
GIDSignIn.sharedInstance().delegate = self
}
In GoogleSignIn SDK 5.0 and above GIDSignInUIDelegate
has been revoked
So Instead of
GIDSignIn.sharedInstance().uiDelegate = self
Add this below line, for conforming to presenting login view
GIDSignIn.sharedInstance()?.presentingViewController = self
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With