2

我正在尝试从用户那里获取电子邮件联系人以显示在应用程序中。我正在努力在我的代码中初始化 GData。我遇到了一些错误。是否可以提供任何教程。或者任何人都可以帮助我解决这个错误。

        GDataEntryContact *contact = [contacts objectAtIndex:i];
        NSString *ContactName = [[[contact name] fullName] contentStringValue];
    GDataEmail *email = [[contact emailAddresses] objectAtIndex:0];

错误:

-[GDataEntryBase name]: unrecognized selector sent to instance 0x1ddcc081
-[GDataEntryBase emailAddresses]: unrecognized selector sent to instance 0x1ddcc081

提前致谢。

----** 已解决 **---- //供参考

- (void)contactsFetchTicket:(GDataServiceTicket *)ticket
       finishedWithFeed:(GDataFeedContact *)feed
                  error:(NSError *)error {
GDataFeedContact *mContactFeed;
if (error) {
    NSLog(@">>>>>>>>>>>>>>>> Fetch error :%@", [error description]);
}else{//--If Login is success
NSArray *entries = [mContactFeed entries];
NSArray *contacts = [feed entries];

for (int i = 0; i < [contacts count]; i++) {
    GDataEntryContact *contact = [contacts objectAtIndex:i];
    NSString *ContactName = [[[contact name] fullName] contentStringValue];
    GDataEmail *email = [[contact emailAddresses] objectAtIndex:0];
    NSString *ContactEmail = [email address];

    if ([ContactName length] == 0) {
        ContactName = @"Empty";
    }
    if ([ContactEmail length] > 0) {
        //Save email
    }
}}
4

0 回答 0