Open Rajveer86 opened 7 years ago
@Rajveer86 Did you solve this issue? What's the implementation to fix it?
@Rajveer86 @Rajveer86 God damn, I have got the same issue! Is there any workaround? Did you solve it? I've implemented GIDSignInUIDelegate in my not-view-controller class (which is only NSObject). I call this code im my class init() method: GIDSignIn.sharedInstance().clientID = "MY_GOOGLE_ID" GIDSignIn.sharedInstance().uiDelegate = self GIDSignIn.sharedInstance().delegate = self When I try to call GIDSignIn.sharedInstance().signIn() in other method of this class, I get crash
'uiDelegate must either be a |UIViewController| or implement the |signIn:presentViewController:| and |signIn:dismissViewController:| methods from |GIDSignInUIDelegate|.'
My class is public, but to implement GIDSignInUIDelegate in it I had to mark those delegate methods internal or private. Maybe this is the problem? When my class wasn't public I was able to login via Google once using this class... And now it just crashes.
@Rajveer86 @rhys-edwards I've solved my problem. In my case the access modifiers broke my implementations, and since all method in GIDSignInUIDelegate are optionals Swift compiler wasn't complained about all its methods implementation.
Be careful with access modifiers. And I think that those methods must be required:
because if you haven't implemented them your application will crash.
add this "[GIDSignIn sharedInstance].presentingViewController=self;" it can solved this problem.
I have a class that implements GIDSignInUIDelegate. When I set GIDSignIn's uiDelegate to said class, I get an exception stating the following:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'uiDelegate must either be a |UIViewController| or implement the |signIn:presentViewController:| and |signIn:dismissViewController:| methods from |GIDSignInUIDelegate|.'
These methods are implemented in my class, therefore I'm assuming that the class needs to implement GIDSignInUIDelegate AND be a UIViewController, not OR.