1

Gmail アカウントから連絡先を取得しようとすると、次のエラーが発生します。

 "ViewController" selector "ticket:finishedWithFeed:" should have 3 arguments
*** Assertion failure in void GTMAssertSelectorNilOrImplementedWithArgs(id, SEL, ...)(), 
/gtm-oauth2/GTMHTTPFetcher.m:1607
 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'callback selector arguments incorrect' 

   -(void)getGoogleContacts {

    GDataServiceGoogleContact *service =
    [[GDataServiceGoogleContact alloc] init];

    NSString *username = @"username@gmail.com";
    NSString *password = @"pass";

    service = [[GDataServiceGoogleContact alloc] init];

    [service setUserAgent:@"McGraggerSoft-GoogleContactUtility-1.0"];
    [service setUserCredentialsWithUsername:username password:password];

    ticket = [service fetchContactFeedForUsername:username delegate:self didFinishSelector:@selector(ticket:finishedWithFeed:)];
}


- (void)ticket:(GDataServiceTicket *)ticket finishedWithFeed:(GDataFeedContact *)feed
{

    if ([[feed entries] count] > 0) {

        GDataEntryContact *firstContact = [[feed entries] objectAtIndex:0];
        GDataTextConstruct *titleTextConstruct = [firstContact title];
        NSString *title = [titleTextConstruct stringValue];

        NSLog(@"first contact's title:%@", title);
    }
}



- (void)viewDidLoad
{
    [super viewDidLoad];
    [self getGoogleContacts];
}
4

1 に答える 1

2

API は 3 つのパラメーターを持つセレクターを想定しているようです。NSError*

- (void)    ticket:(GDataServiceTicket *)ticket
  finishedWithFeed:(GDataFeedContact *)feed
             error:(NSError *)error {
    ...
}

...

ticket = [service fetchContactFeedForUsername:username delegate:self didFinishSelector:@selector(ticket:finishedWithFeed:error:)];
于 2013-04-24T13:16:04.093 に答える