且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何抢在iOS的谷歌日历事件

更新时间:2023-12-03 14:12:04

该链接上有一个项目,帮助我超越的奇迹。现在我只需要寻找到保护我检索数据:的http:// code.google.com / p / iphone-兆千卡/

I've been looking over the google data's API specifically with the need to grab information from a Google Calendar and importing it into an application I've created (I just need to place and store the data for now so the example below will be using a tableview). I can't seem to find direct references to functions/methods and what they do making this extremely annoying. Would someone be able to guide me? All I want to do is pull all events from a calendar. No editing and such. I'm not even sure if I'm going down the right direction.

-(void)fetchEntries{
    calendarService = [[GDataServiceGoogleCalendar alloc] init];

    NSString *username = @"Gmail Username";
    [calendarService setUserCredentialsWithUsername:username password:@"password"];
    NSURL *feedURL = [GDataServiceGoogleCalendar calendarFeedURLForUsername:username];

    GDataServiceTicket *ticket;
    ticket = [calendarService fetchFeedWithURL:feedURL delegate:self didFinishSelector:@selector(ticket:finishedWithFeed:error:)];
    //ticket = [calendarService fetchFeedWithURL:feedURL delegate:self didFinishSelector:@selector(calendarEventsTicket:finishedWithEntries:error:)];

}

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

    if (error == nil) {
        NSArray *entries = [feed entries];
        if ([entries count] > 0) {

            GDataEntryCalendar *firstCalendar = [entries objectAtIndex:0];
            GDataTextConstruct *titleTextConstruct = [firstCalendar title];
            NSString *title = [titleTextConstruct stringValue];

            NSString *description = [firstCalendar description];

            NSLog(@"first calendar's title: %@ and description: %@", title, description);


            GDataLink *link = [firstCalendar alternateLink];
            [self beginFetchingFiveEventsFromCalendar:firstCalendar];

            if (link != nil) {
//                [service fetchFeedWithURL:[link URL] delegate:self didFinishSelector:@selector(eventsTicket:finishedWithFeed:error:)];
                NSLog(@"\n\nAlternate link: %@", link);
            }
        } else {
            NSLog(@"the user has no calendars");
        }
    } else {
        NSLog(@"fetch error: %@", error);
    }



}

This link has a project on it that has helped me beyond wonders. Now I just need to look into securing the data I retrieve: http://code.google.com/p/iphone-gcal/