如何使用gdata检索Google日历事件的描述? [英] how to retrieve google calendar event's description using gdata?

查看:43
本文介绍了如何使用gdata检索Google日历事件的描述?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用目标C中的gdata库为iPhone应用程序检索Google日历事件,我是这样做的,

I am retrieving google calendar events using gdata library in objective c for an iphone application, I am doing it like this,

- (void)eventsTicket:(GDataServiceTicket *)ticket finishedWithEntries:(GDataFeedCalendarEvent *)feed error:(NSError *)error
{
  if( !error ){
    NSMutableDictionary *dictionary;
    for( int section=0; section<[data count]; section++ ){
      NSMutableDictionary *nextDictionary = [data objectAtIndex:section];
      GDataServiceTicket *nextTicket = [nextDictionary objectForKey:KEY_TICKET];
      if( nextTicket==ticket ){     // We've found the calendar these events are meant for...
        dictionary = nextDictionary;
        break;
      }
    }

    if( !dictionary )
      return;       // This should never happen.  It means we couldn't find the ticket it relates to.

    int count = [[feed entries] count];  // count for the number of events for the callendar
//099999999999999999999999999999999966666666666666669999999999999999999999999666666666666666699999999999999999999999999999999999999999999999999999999999
    daily_trackAppDelegate *controller =(daily_trackAppDelegate *) [[UIApplication sharedApplication] delegate];


      NSMutableArray *events = [dictionary objectForKey:KEY_EVENTS];
      for( int i=0; i<count; i++ ){
      [events addObject:[[feed entries] objectAtIndex:i]];  //loads the array with events
      }


      for( int i=0; i<count; i++ ){
          NSMutableArray *temporary=[[NSMutableArray alloc]init];

          [temporary removeAllObjects];

          GDataEntryCalendarEvent *event = [events objectAtIndex:i];

        //  [controller.googlearray addObject:event];

          GDataWhen *when = [[event objectsForExtensionClass:[GDataWhen class]] objectAtIndex:0];


          if( when ){
              NSDate *date1 = [[when startTime] date];
              NSDate *date = [date1 dateByAddingTimeInterval:18000.0];
              NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

              [dateFormatter setDateFormat:@"yy-MM-dd-HH-mm"];
              [temporary addObject:date];///1   date

              NSDate *date11=[[when endTime] date];
              NSDate *date2 = [date11 dateByAddingTimeInterval:18000.0];
             // [controller.array_objject.google_events insertObject:date atIndex:i];///2   date
              [temporary addObject:date2];///1   date

              [dateFormatter release];
          }
          //[controller.array_objject.google_events insertObject:[[event title] stringValue] atIndex:i];  /////3   title
          [temporary addObject:[[event title] stringValue]];///1   date
        GDataWhere *addr = [[event locations] objectAtIndex:0];
          if( addr )
              //[controller.array_objject.google_events insertObject:[addr stringValue] atIndex:i];///// 4   location
              [temporary addObject:[addr stringValue]];
               [controller.googlearray addObject:temporary];///// 4   location

      }
NSURL *nextURL = [[feed nextLink] URL];
    if( nextURL ){    // There are more events in the calendar...  Fetch again.   FETCHING*********************************
      GDataServiceTicket *newTicket = [googleCalendarService fetchFeedWithURL:nextURL delegate:self didFinishSelector:@selector( eventsTicket:finishedWithEntries:error: )];   // Right back here...
      // Update the ticket in the dictionary for the next batch.
      [dictionary setObject:newTicket forKey:KEY_TICKET];
    }
  } else
    [self handleError:error];
}

现在我正在这里检索事件的开始和结束时间,标题,位置等,但是我还想检索事件的描述,这意味着用户在创建事件时是否输入了任何描述,因此在这种情况下,我我也想检索事件的描述或详细信息,但我努力了,但徒劳无功.

now I am retrieving the start and ending time, title, location etc. of the event here, but I also want to retrieve the description of the event, means if user enters any description while creating event, so in that case I want to retrieve that description or details of event too, I tried hard but in vain.

推荐答案

事件的描述可以作为[[eventEntry content] stringValue]

The description of an event is available as [[eventEntry content] stringValue]

这篇关于如何使用gdata检索Google日历事件的描述?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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