如何使用GData获取电子邮件联系人

时间:2013-07-12 04:32:42

标签: ios objective-c gdata-api

我正在尝试从用户那里获取电子邮件联系人以显示在App.i中,我的代码中的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
    }
}}

0 个答案:

没有答案