I'm writing an iOS app in obj-c and using Google SignIn SDK to do the Google SignIn flow. I wanna be able to customize the button and action a little it so I went ahead implementing the protocols of GIDSignInDelegate
myself based on their documentation. But it throws and exception for no reason.
Here's the minimal code of my view controller.
viewcontroller.m
#import "ViewController.h"
#import <FBSDKLoginKit/FBSDKLoginKit.h>
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *GoogleSignIn;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)googleButtonTouchUpInside:(id)sender {
[[GIDSignIn sharedInstance] signIn];
}
// Implement these methods only if the GIDSignInUIDelegate is not a subclass of
// UIViewController.
// Stop the UIActivityIndicatorView animation that was started when the user
// pressed the Sign In button
- (void)signInWillDispatch:(GIDSignIn *)signIn error:(NSError *)error {
//[UIActivityIndicatorView stopAnimating];
}
// Present a view that prompts the user to sign in with Google
- (void)signIn:(GIDSignIn *)signIn
presentViewController:(UIViewController *)viewController {
[self presentViewController:viewController animated:YES completion:nil];
}
// Dismiss the "Sign in with Google" view
- (void)signIn:(GIDSignIn *)signIn
dismissViewController:(UIViewController *)viewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
@end
viewcontroller.h
#import <UIKit/UIKit.h>
#import <Google/SignIn.h>
@interface ViewController : UIViewController <GIDSignInUIDelegate>
@end
I do have whatever delegate method is required for a custom login flow google doc Did I miss anything?