Search code examples
iphoneobjective-cxcodeoauthgdata

Assistance with error using OAuth2 to login to google for iPhone


I am currently implementing the GData framework to authenticate and post to picasa. So far I have a working framework configuration. This allows me to push and authenticate with / attempt to authenticate with google. The only issue I seem to be having is when the app returns following authentication I receive a crash with the following error

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

* First throw call stack: (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)

My authentication code is as follows

            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];

Please help in anyway you can. Thank you very much! - Jim

Update: This reason this was happening was due to a misconfiguration with the selector "finishedSelector:finishedSel". When the app would return the selector could not be found and therefore would cause this crash. The above auth code works well however so I hope this is useful to anyone who needs help with oAuth for GData authentication. Thanks!


Solution

  • Verify that the declared selector finishedSet is correct, do you correctly declare viewController:finishedWithAuth:error: for the current object?

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