ios6 - 日历已弃用

标签 ios6 calendar

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 中首次不推荐使用”
如何解决?

最佳答案

相反,您必须使用以下方法。

- (NSArray *)calendarsForEntityType:(EKEntityType)entityType;


NSArray *cals = [eventStore calendarsForEntityType: EKEntityTypeEvent];

并使用数组 cals在第 2 行。

查看文档 here

关于ios6 - 日历已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14438410/

相关文章:

ajax - IOS6 和 Safari 照片上传 - 文件 API + Canvas + jQuery Ajax 异步上传和调整文件大小

iphone - 带有 CCLayer for iOS 6 的 Cocos2d 横向 Gamecenter 身份验证

ios6 - map View 打开 iOS 时动画缩放到位置/ map 地标

java - 查找给定日期是星期几

javascript - D3.js:尝试构建平面日历

iphone - UINavigationController 栈

objective-c - 监视目录时dispatch_source_get_data不返回正确的标志

javascript - 如何在日期选择器中将日期格式 (MM/DD/YY) 更改为 (YYYY-MM-DD)

java - Date d = Calendar.getTime() 返回错误的时间?