在ios中使用google plus进行签名时遇到错误

时间:2015-02-11 16:03:05

标签: objective-c login google-plus unrecognized-selector

我在实施google +登录时遇到以下错误。

    2015-02-11 21:23:27.925 SIR[3761:154305] -[__NSDictionaryM gtm_httpArgumentsString]: unrecognized selector sent to instance 0x78e53cb0
    2015-02-11 21:23:27.929 SIR[3761:154305] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-         [__NSDictionaryM gtm_httpArgumentsString]: unrecognized selector sent to instance 0x78e53cb0'            

- (void)viewDidLoad {
[super viewDidLoad];
checkUp=NO;
class=[[ArrayClass alloc]init];
class.delegate=self;
[class calledWhenStringISPArsed:@"1"];
datePicker.tintColor=[UIColor whiteColor];
[datePicker setValue:[UIColor whiteColor] forKeyPath:@"textColor"];
timeTextField.delegate=self;
textField1.delegate=self;
textField2.delegate=self;
testField3.delegate=self;
textField4.delegate=self;
textField5.delegate=self;
textField6.delegate=self;    
    GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
//signIn.shouldFetchGoogleUserEmail = YES;  // Uncomment to get the user's email

// You previously set kClientId in the "Initialize the Google+ client" step
signIn.clientID = KclientId;


// Your server's OAuth 2.0 client ID
signIn.homeServerClientID = @"LBtgIHvSZ7HPScQ7vSEr85hl";


// Uncomment one of these two statements for the scope you chose in the previous step
signIn.scopes = @[ kGTLAuthScopePlusLogin ];  // "https://www.googleapis.com/auth/plus.login" scope
//signIn.scopes = @[ @"profile" ];            // "profile" scope

// Optional: declare signIn.actions, see "app activities"
signIn.delegate = self;
     [signIn trySilentAuthentication];
[self setGooglePlusButtons]}    
-(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];}

以上是我为google登录实施的代码 查看代码,如果您发现任何解决方案,请告诉我。

1 个答案:

答案 0 :(得分:6)

因为您没有设置其他链接标记

  1. 转到您的项目目标
  2. 然后转到构建设置>联
  3. 并将其他链接标记设置为: -ObjC