我在集成 google plus 日志时遇到问题 我收到以下错误:
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'
我用来谷歌登录的代码如下:
-(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];}
在应用委托(delegate)中
- (BOOL)application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation {
return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];}
我在顶部声明了 kclientId
static NSString * const KclientId=@"xxxxxxxxxxxxxxx.apps.googleusercontent.com";
我已经试过了,但我找不到问题所在。
最佳答案
我在使用 Swift 时遇到了同样的问题,我认为您必须在build设置上启用一些标志并启用一些库。
转到build设置/链接/其他链接器标志并添加不带引号的“-ObjC”。这假设您正在使用一些“头文件”来映射 Google 框架和 Swift 方法。
转到 Build Phases >Link Binary with Librairies > + > 添加其他,转到 de/usr/lib 目录并选择“libz.dylib”
编译
关于objective-c - 面对 google plus 登录 IOS 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28564024/