0
A
回答
0
-(void)EventList{
EKEventStore *eventStore = [[EKEventStore alloc] init];
if([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
// iOS 6 and later
ReadCalendar = TRUE;
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
if (granted){
//---- codes here when user allow your app to access theirs' calendar.
[self performCalendarActivity];
}else
{
//----- codes here when user NOT allow your app to access the calendar.
}
}];
}
else {
//---- codes here for IOS < 6.0.
[self performCalendarActivity];
}
}
-(void)performCalendarActivity{
self.eventStore = [[EKEventStore alloc] init];
eventsList = [[NSMutableArray alloc] initWithArray:0];
// Get the default calendar from store.
self.defaultCalendar = [self.eventStore defaultCalendarForNewEvents];
eventsList= [[self fetchEventsForToday] mutableCopy];
}
-(NSArray *)fetchEventsForToday {
NSDate *startDate;
NSDate *endDate;
startDate = [NSDate date];
endDate = [NSDate dateWithTimeIntervalSinceNow:86400];
// Create the predicate. Pass it the default calendar.
NSArray *calendarArray = [NSArray arrayWithObject:defaultCalendar];
NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate endDate:endDate
calendars:calendarArray];
// Fetch all events that match the predicate.
NSArray *events = [self.eventStore eventsMatchingPredicate:predicate];
return events;
}
相关问题
- 1. 如何将我的应用程序链接到iphone日历
- 2. 如何从iPhone/iPad应用程序添加多个事件到iPhone日历?
- 3. 如何将CSV文件导入我的iPhone应用程序?
- 4. 从iPhone应用程序导入本地日历的可能性
- 5. 如何在我的iPhone应用程序中使用日历?
- 6. 将多个事件导入Android日历
- 7. ASP.Net日历/事件应用程序
- 8. 如何从我的应用程序中打开iPhone日历?
- 9. 如何使用java将CSV日历导入到我的Google日历中
- 10. 同步iPhone日历事件删除与事件存储在应用程序
- 11. 如何将数据库导入到我的iphone程序中?
- 12. 将.xls/.csv导入iPhone应用程序
- 13. 如何将日历组件插入到Angular 2应用程序中?
- 14. 如何从asp应用程序更新Google日历事件?
- 15. 如何通过Android应用程序来编辑日历事件
- 16. Laravel,将我的活动导出到Google日历(或任何其他受欢迎的日历应用程序?)
- 17. iPhone应用程序:同步Google日历
- 18. 如何通过我的Xcode应用程序更新我的iPhone上的日历
- 19. 如何将事件自动从isc文件导入到客户日历中
- 20. 如何将我的代码导出到应用程序文件中? (iPhone)
- 21. 如何让用户将日历事件从我的应用程序拖放到iCal?
- 22. 如何将rss feed中的数据导入iPhone应用程序
- 23. iphone谷歌日历事件
- 24. 我的应用程序如何获取用户iPhone上的日历列表
- 25. 如何在iPhone应用程序中使用谷歌日历?
- 26. 如何获取设备日历(默认日历)事件并显示在我们的应用程序中?
- 27. 如何将Google日历链接到应用程序?
- 28. 日历我的iPhone应用程序项目
- 29. iPhone日历中的多日事件
- 30. 如何将XIB iPhone应用程序转换为故事板iPhone应用程序
可能重复[编程方式在iPhone日历中添加自定义事件](HTTP://计算器.COM /问题/ 246249 /的程序化LY-插件自定义事件中最iphone日历) – 0xDE4E15B 2012-04-12 10:10:06