Question

I integrate gmail into my app by using GData Obcective-C Client for authentication and obtaining therefrom contacts. For authentication I use gtm-oauth2 and this part work pretty good.

My scope for GTMOAuth2ViewControllerTouch init:

NSString *scope = [NSString stringWithFormat:@"https://www.googleapis.com/auth/plus.me %@", [GDataServiceGoogleContact authorizationScope]];

Auth init:

__keychainItemName = [infoPlist objectForKey:@"GoogleKeyChainItem"];

__auth = [GTMOAuth2ViewControllerTouch
                  authForGoogleFromKeychainForName:__keychainItemName
                  clientID:[infoPlist objectForKey:@"GoogleClientID"]
                  clientSecret:[infoPlist objectForKey:@"GoogleClientSecret"]];

For GData building i use this blog (with pics and stuff)

http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/

GData I get from google repository, just by running this in console

# Non-members may check out a read-only working copy anonymously over HTTP.
svn checkout http://gdata-objectivec-client.googlecode.com/svn/trunk/ gdata-objectivec-client-read-only

Problems begin when I try to get contacts:

- (GDataServiceGoogleContact *)contactService {

    static GDataServiceGoogleContact* service = nil;

    if (!service) {
        service = [[GDataServiceGoogleContact alloc] init];
        [service setShouldCacheResponseData:YES];
        [service setServiceShouldFollowNextLinks:YES];
        [service setAuthorizer:__auth];
    }

    return service;
}

- (void) methodExecute {
    GDataServiceGoogleContact *service = [self contactService];

    GDataServiceTicket *ticket;

    const int kBuncha = 2000;

    NSURL *feedURL =  [GDataServiceGoogleContact contactFeedURLForUserID:kGDataServiceDefaultUser];

    GDataQueryContact *query = [GDataQueryContact contactQueryWithFeedURL:feedURL];
    [query setShouldShowDeleted:NO];
    [query setMaxResults:kBuncha];

    [ticket setAuthorizer:__auth];

    ticket = [service fetchFeedWithQuery:query
                                delegate:self
    didFinishSelector:@selector(contactsFetchTicket:finishedWithFeed:error:)];
}

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

    if(error != nil){
        NSLog(@"%@\n\n\n%@", error, feed);
    }
    else{
        NSLog(@"%@\n\n\n%@", error, feed.entries);
    }
}

And here is the point - instead of GDataEntryContact which have to be in feed, I get array of GDataEntryBase objects. There is object description example:

GDataEntryBase 0xb3b2300: {v:3.1 title:John Jackson etag:"Rn4_fjVSLit***." 
categories:1 links:photo,self,edit edited:2013-03-14T17:55:57Z
id:http://www.google.com/m8/feeds/contacts/myemail%40gmail.com/base/kindofid 
unparsed:<gContact:groupMembershipInfo>,<gd:name>,<gd:phoneNumber>}

I try to replace svn GData to This GData version, but everything is useless. I'm on the edge.

BTW I also turned "on" the option Contacts API at google console and added -DGDATA_INCLUDE_CONTACTS_SERVICE=1 in Other C Flags for GData.

Am I missed something or just stupid?

Great thanks for your reply!

Was it helpful?

Solution

I entered other linker flags only for project and they are, for some reason, do not applied for the whole target.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top