Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facing issue with the google plus login IOS

I am facing problem while integrating the google plus log i got the following error:

2015-02-17 20:03:39.377 SIR[288:14344] -[__NSDictionaryM gtm_httpArgumentsString]: unrecognized selector sent to instance 0x14d57a20
2015-02-17 20:03:39.383 SIR[288:14344] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM gtm_httpArgumentsString]: unrecognized selector sent to instance 0x14d57a20'

The code i used to google login is below:

 -(void) setGooglePlusButtons {
UIButton *googlePlusSignInButton = [UIButton buttonWithType:UIButtonTypeCustom] ;


UIImage *backgroundButtonImage = [UIImage imageNamed:@"google.png"];

googlePlusSignInButton.frame = CGRectMake(0.0f,
                                           400,
                                           150,
                                           50);

googlePlusSignInButton.titleLabel.textColor = [UIColor whiteColor];
googlePlusSignInButton.titleLabel.font = [UIFont boldSystemFontOfSize:11.0f];
googlePlusSignInButton.titleLabel.numberOfLines = 2;

googlePlusSignInButton.titleLabel.shadowColor = [UIColor darkGrayColor];
googlePlusSignInButton.titleLabel.shadowOffset = CGSizeMake(0.0f,
                                                             -1.0f);

[googlePlusSignInButton setTitle:NSLocalizedString(@"", @"")
                         forState:UIControlStateNormal];

[googlePlusSignInButton setBackgroundImage:backgroundButtonImage
                                   forState:UIControlStateNormal];
[self.view addSubview:googlePlusSignInButton];

[googlePlusSignInButton addTarget:self action:@selector(signInGoogle) forControlEvents:UIControlEventTouchUpInside];}

- (void)signInGoogle {
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.delegate = self;
signIn.shouldFetchGoogleUserEmail = YES;
signIn.clientID = KclientId;
signIn.scopes = [NSArray arrayWithObjects:kGTLAuthScopePlusLogin,nil];
signIn.actions = [NSArray arrayWithObjects:@"http://schemas.google.com/ListenActivity",nil];
[[GPPSignIn sharedInstance] authenticate];}


- (void)signOut {
[[GPPSignIn sharedInstance] signOut];}

and in app delegate

    - (BOOL)application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation {

return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];}

and i declared at the top kclientId

static NSString * const KclientId=@"xxxxxxxxxxxxxxx.apps.googleusercontent.com";

i have tried it on my end but i am not able to found the issue that where i am going wrong.

like image 977
PAn Kaj Khatri Avatar asked Feb 17 '15 14:02

PAn Kaj Khatri


People also ask

Why can I not sign into my Google Account on iPhone?

Update your device to the latest version of iOS or iPadOS. You can update your device wirelessly by going to Settings > General > Software Update and if there is an update, follow the onscreen instructions to update your device. Clear the history, cache and cookies to see if this fixes your problem.

Why is login with Google Not Working?

Get troubleshooting tipsYour sign-in may be blocked if the device or location you're using is new. Try again from a device or location that you commonly sign in from. Sign in to your Google Account on the new device and try again the following week.

How do I sign into Google on iOS?

On your iPhone or iPad, open the Safari app. Go to www.google.com. Tap your profile image or Sign in. Follow the sign-in steps.

Why does Safari keep asking me to sign into Google?

Unfortunately this behaviour is due to Apple & Safari security/privacy features when using the 'private' mode to prevent tracking. Google will experience each new tab to be unrelated to any previous or open tabs on your device, so will not know you are resistant to signing in, so will show that message every time.


2 Answers

I faced the same issue with Swift,I think you must enable some flags on the build setting and enable some library.

  1. Go to Build settings / Linking / Other Linker Flags and add the "-ObjC" without the quotes. This assume you are using some "header file" to map Google framework and for Swift approach.

  2. Go to Build Phases >Link Binary with Librairies > + > Add other, the go to de /usr/lib directory and select "libz.dylib"

  3. Compile

like image 71
Zerausolrac Avatar answered Oct 04 '22 05:10

Zerausolrac


The NSDictionary extension, that defines gtm_httpArgumentsString is located in GoogleToolboxForMac framework. Make sure you link to that framework.

like image 37
Vladimir Grigorov Avatar answered Oct 04 '22 05:10

Vladimir Grigorov