Search code examples
objective-ciosgoogle-apigoogle-calendar-apigdata

Why are there no times in any of my GDataEntryCalendarEvent?


I am using a GDataServiceGoogleCalendar to anonymously fetch a GDataFeedCalendarEvent from a public url. But I am absolutely unable to retrieve times from any of the resulting GDataEntryCalendarEvent objects. I can read the title, so I believe the API works, but somehow the times arrays are lost somewhere.

The service is instantiated as follows:

- (GDataServiceGoogleCalendar *)calendarService {

    static GDataServiceGoogleCalendar* service = nil;

    if (!service) {
        service = [[GDataServiceGoogleCalendar alloc] init];

        [service setShouldCacheResponseData:YES];
        [service setServiceShouldFollowNextLinks:YES];
        [service setIsServiceRetryEnabled:YES];
    }

    return service;
}

This is the code where the data is retrieved:

for (GDataEntryCalendarEvent *event in eventEntries) {
    NSString *title = [[event title] stringValue];

    GDataDateTime *startTime = nil;
    GDataDateTime *endTime = nil;

    NSArray *times = [event times];
    GDataWhen *when = nil;
    if ([times count] > 0) {
        when = [times objectAtIndex:0];
        startTime = [when startTime];
        endTime = [when endTime];
    }
}

What is wrong with my code or the way I connect? The sample app retrieves the dates successfully.


Solution

  • The Google API requires the use of an actual identified user even to access the public data. So no access to most API call s is granted until an authenticated user account is being used.