如何抢在iOS的谷歌日历事件 [英] How to grab Google Calendar events in iOS

查看:254
本文介绍了如何抢在iOS的谷歌日历事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找在谷歌数据的API专门与需要从谷歌日历抓取信息并将其导入我创建了一个应用程序(我只需要放置和存储数据,现在所以下面的例子将使用的tableview)。我似乎无法找到函数/方法和他们做了什么使这个非常恼人的直接引用。会有人能指导我?所有我想要做的是拉从一个日历中的所有事件。没有编辑和等。我甚至不知道如果我要下去了正确的方向。

   - (无效){fetchEntries
    calendarService = [[GDataServiceGoogleCalendar的alloc]初始化];    * NSString的用户名= @Gmail用户名;
    [calendarService setUserCredentialsWithUsername:用户名密码:@密码];
    NSURL * feedURL = [GDataServiceGoogleCalendar calendarFeedURLForUsername:用户名]。    GDataServiceTicket *票;
    门票= [calendarService fetchFeedWithURL:feedURL委托:自我didFinishSelector:@selector(门票:finishedWithFeed:错误:)];
    //票= [calendarService fetchFeedWithURL:feedURL委托:自我didFinishSelector:@selector(calendarEventsTicket:finishedWithEntries:错误:)];} - (无效)门票:(GDataServiceTicket *)票
finishedWithFeed:(GDataFeedCalendar *)饲料
         错误:(NSError *)错误{    如果(错误==无){
        NSArray的*条目= [提要条目]
        如果([条目计数]&0){            GDataEntryCalendar * firstCalendar = [条目objectAtIndex:0];
            GDataTextConstruct * titleTextConstruct = [firstCalendar标题]
            * NSString的标题= [titleTextConstruct stringValue的];            * NSString的描述= [firstCalendar描述];            的NSLog(@第一个日历的标题:%@和说明:%@,标题,描述);
            GDataLink *链接= [firstCalendar alternateLink]
            [个体经营beginFetchingFiveEventsFromCalendar:firstCalendar];            如果(链接!=无){
// [服务fetchFeedWithURL:[链接URL]委托:自我didFinishSelector:@selector(eventsTicket:finishedWithFeed:错误:)];
                的NSLog(@\\ n \\ nAlternate链接:%@,链接);
            }
        }其他{
            的NSLog(@的用户没有日历);
        }
    }其他{
        的NSLog(@提取错误:%@,错误);
    }}


解决方案

该链接上有一个项目,帮助我超越的奇迹。现在我只需要寻找到保护我检索数据:的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/

这篇关于如何抢在iOS的谷歌日历事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆