I'm having an issue with the gData Contact APIs in Objective C on an
iPhone app. I only recently updated from the original Contact APIs to
v3.0. When doing so, the contact fetch is now returning different
results for one of the users (it still works correctly for others) of
our software. I am doing a Full Feed contact fetch. After the fetch
completes and the GDataFeedContact object is returned, if I call
[object totalResults];
on that object I get the total number of contacts. in this case
3900+. This number is correct. If I then call
[[object entries] count];
on that object, I only get a count of 2700. With the old API, the
entry count was the same as the totalResults count (I have a copy of
the project using the old APIs and have confirmed this). So with the
new APIs I am missing over 1200 contacts for some reason. And none of
my code has changed. I've looked at the changes and checked the
migration requirements for the new API, but I have not seen anything
related to this. I am relatively new to Objective C and iPhone
development, so I could have easily missed/overlooked something. Is
there a change I need to make for contact fetching? Here is my
relevant code:
Helper method to create a service:
+ (GDataServiceGoogleContact *)gDataContactService {
static GDataServiceGoogleContact* service = nil;
if (!service) {
service = [[GDataServiceGoogleContact alloc] init];
[service setUserAgent:@"FBA.net-ContactSync"];
[service setShouldCacheDatedData:YES];
[service setServiceShouldFollowNextLinks:YES];
}
UserSettings* userSettings = [StaticDB getCurrentUserSettings];
// update the username/password each time the service is requested
[service setUserCredentialsWithUsername:[userSettings email]
password:[userSettings password]];
[service setCaptchaToken:NULL captchaAnswer:NULL];
[service setShouldServiceFeedsIgnoreUnknowns:YES];
return service;
}
Main fetch method:
- (void)fetchContacts:(GDataDateTime*)gMailServerTime {
[UIApplication sharedApplication].networkActivityIndicatorVisible =
TRUE;
lblStatus.text = NSLocalizedString
(@"SyncViewController1_DownloadingGmailContacts", @"");
[self setContactFeed:NULL];
GDataServiceGoogleContact *service = [ContactHelper
gDataContactService];
GDataServiceTicket *ticket;
// request a whole buncha contacts; our service object is set to
// follow next links as well in case there are more than
kFBAGDataQueryMaxResults
NSURL *feedURL = [NSURL
URLWithString:kGDataGoogleContactDefaultFullFeed];
GDataQueryContact *query = [GDataQueryContact
contactQueryWithFeedURL:feedURL];
[query setMaxResults:kFBAGDataQueryMaxResults];
NSDate* updatedMinTime = NULL;
if ( [mCurrentUserSettings googleNextFeedTimeToFetchFrom] ) {
updatedMinTime = [mCurrentUserSettings
googleNextFeedTimeToFetchFrom];
} else {
updatedMinTime = [[mCurrentUserSettings
googleLastProcessedFeedTime]
addTimeInterval:-180];
}
if ( gMailServerTime && updatedMinTime &&
[[gMailServerTime date] timeIntervalSinceDate:updatedMinTime] <
kFBAMaximumSecondsBetweenSyncsForLastModified ) {
[query setShouldShowDeleted:TRUE];
[query setUpdatedMinDateTime:[GDataDateTime
dateTimeWithDate:updatedMinTime timeZone:[NSTimeZone
timeZoneWithName:@"Universal"]]];
mIsProcessingAllGmailContacts = FALSE;
} else {
[query setShouldShowDeleted:FALSE];
mIsProcessingAllGmailContacts = TRUE;
}
ticket = [service fetchContactQuery:query
delegate:self
didFinishSelector:@selector
(contactsFetchTicket:finishedWithFeed:)
didFailSelector:@selector
(contactsFetchTicket:failedWithError:)];
}
If you need to see any other method calls, let me know. But it seems
almost like 2700 is a cap of some kind being hit on the number of
contacts return. We have max results set to 100 with the service set
to follow next links, so as I understand it, it should handle all the
contacts..
Thanks,
Jason
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---