OStack程序员社区-中国程序员成长平台

标题: ios - 如何使用 gdata 检索谷歌日历事件的描述? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:21
标题: ios - 如何使用 gdata 检索谷歌日历事件的描述?

我正在使用 objective-c 中的 gdata 库为 iphone 应用程序检索谷歌日历事件,我正在这样做,

- (void)eventsTicketGDataServiceTicket *)ticket finishedWithEntriesGDataFeedCalendarEvent *)feed errorNSError *)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 didFinishSelectorselector( 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];
}

现在我在这里检索事件的开始和结束时间、标题、位置等,但我也想检索事件的描述,这意味着如果用户在创建事件时输入任何描述,所以在这种情况下我我也想检索那个描述或事件的详细信息,我努力但没有成功。



Best Answer-推荐答案


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

关于ios - 如何使用 gdata 检索谷歌日历事件的描述?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7709443/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4