Before I begin, I have searched Stackoverflow for how to do this, and I saw a lot of related posts, but none worked for me and I'm not sure why.
So basically I have a loginViewController, and in it, I have a method that call's GoogleSignIn:
- (void)googleTap:(id)sender
{
[[GIDSignIn sharedInstance] signIn];
}
Now the way GoogleSignIn is set up, the result of that sign in call is handled inside AppDelegate.m
- (void)signIn:(GIDSignIn *)signIn
didSignInForUser:(GIDGoogleUser *)user
withError:(NSError *)error {
// Perform any operations on signed in user here.
if (!error) {
NSString *userId = user.userID; // For client-side use only!
NSString *idToken = user.authentication.idToken; // Safe to send to the server
NSString *name = user.profile.name;
NSString *email = user.profile.email;
NSLog(@"Name: %@, User: %@, Token: %@, Email: %@",name, userId, idToken, email);
// ...
}
}
Inside this AppDelegate method, I want to call a method from my loginViewController:
-(void)onSuccessfulLogin{
NSLog(@"On Successful Login");
[self.navigationController pushViewController:[collectionViewController new] animated:YES];
}
I tried these answers: Calling UIViewController method from app delegate
want to call ViewController's method from appdelegate
and the NSLog is called, but the new ViewController is never pushed...why is that and how can I get that to work?