2012-04-06 71 views
2

我目前正在實施GData框架進行身份驗證併發布到picasa。到目前爲止,我有一個工作框架配置。這使我可以推送並驗證/嘗試使用Google進行身份驗證。我似乎有唯一的問題是,當應用程序返回以下驗證我收到崩潰並出現以下錯誤幫助錯誤使用OAuth2登錄谷歌的iPhone

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSInvocation invocationWithMethodSignature:]: method signature argument cannot be nil' 

*第一擲調用堆棧: (0x281c022 0x43c3cd6 0x2781a52 0x1d134b 0x27824ed 0x2782407 0x1ce0fa 0x1cdf0b 0x1cdebb 0x27824ed 0x2782407 0x22185e 0x221670 0x22270a 0x1926a49 0x1924e84 0x1925ea7 0x1924e3f 0x1924fc5 0x1869f5a 0xca3a39 0xd70596 0xc9a120 0xd70117 0xc99fbf 0x27f094f 0x2753b43 0x2753424 0x2752d84 0x2752c9b 0x29ae7d8 0x29ae88a 0xf23626 0x1c332d 0x2995)

我的認證碼如下

  NSString *clientID = @"blogityblaablaa"; 
     NSString *clientSecret = @"somecrazycrap"; 

     auth = [GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:kKeychainItemName 
                    clientID:clientID 
                   clientSecret:clientSecret]; 
     [[self photoservice] setAuthorizer:auth]; 

     NSString *scope = [GDataServiceGooglePhotos authorizationScope]; 

     SEL finishedSel = @selector(viewController:finishedWithAuth:error:); 

     GTMOAuth2ViewControllerTouch *viewController; 
     viewController = [GTMOAuth2ViewControllerTouch controllerWithScope:scope 
                    clientID:clientID 
                   clientSecret:clientSecret 
                  keychainItemName:kKeychainItemName 
                    delegate:self 
                  finishedSelector:finishedSel]; 

     NSString *html = @"<html><body bgcolor=silver><div align=center>Loading sign-in page...</div></body></html>"; 
     viewController.initialHTMLString = html; 

     [[del navigationController] pushViewController:viewController animated:NO]; 

無論如何請幫助。非常感謝你! - Jim

更新:這種情況發生的原因是由於選擇器的錯誤配置「finishedSelector:finishedSel」。當應用程序將返回選擇器無法找到,因此會導致此崩潰。上面的認證代碼運行良好,但是我希望這對任何需要使用oAuth進行GData認證的人都很有用。謝謝!

回答

0

驗證聲明的選擇器finishedSet是否正確,你正確地聲明viewController:finishedWithAuth:error:對於當前對象嗎?

SEL finishedSel = @selector(viewController:finishedWithAuth:error:); 
+0

這是該錯誤的原因。非常感謝你! – mejim707 2012-04-17 19:57:41

0

替換此行:

[[del navigationController] pushViewController:viewController animated:NO];

與此:

[[self navigationController] pushViewController:viewController animated:NO];