【问题标题】:Calendars deprecated已弃用日历
【发布时间】:2013-01-21 20:38:08
【问题描述】:
if ([eventStore.calendars count] == 0)   
    { 
        NSLog(@"No calendars are found.");
        return NO;
    }
 EKCalendar *targetCalendar = nil;
 /* Try to find the calendar that the user asked for */
 for (EKCalendar *thisCalendar in eventStore.calendars){ line2
     if ([thisCalendar.title isEqualToString:paramCalendarTitle] &&
         thisCalendar.type == paramCalendarType){
        targetCalendar = thisCalendar;
        break;
     }
}

第 1 行和第 2 行出现错误:“不推荐使用日历:在 IOS 6 中首次不推荐使用”
如何解决?

【问题讨论】:

    标签: ios6 calendar


    【解决方案1】:

    您必须使用以下方法。

    - (NSArray *)calendarsForEntityType:(EKEntityType)entityType;
    
    
    NSArray *cals = [eventStore calendarsForEntityType: EKEntityTypeEvent];
    

    并在 line2 中使用数组 cals

    查看文档here

    【讨论】:

      猜你喜欢
      • 2014-05-03
      • 2014-02-12
      • 2019-01-07
      • 2016-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-03
      相关资源
      最近更新 更多