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 - 如何将本机日历事件导入到我的iPhone应用程序?
- 2. 如何将我的应用程序链接到iphone日历
- 3. 如何将我的iPhone应用程序日历同步到使用iphone sdk的内置日历中的iphone?
- 4. 如何从iPhone/iPad应用程序添加多个事件到iPhone日历?
- 5. iPhone - 如何导入所有日历事件,包括事件ID?
- 6. 如何将CSV文件导入我的iPhone应用程序?
- 7. Iphone日历应用程序
- 8. 添加事件到iPhone的默认日历从我的应用程序
- 9. 我想将事件添加到日历到我的应用程序中
- 10. 使用事件工具包将订阅的日历导入应用程序iOS
- 11. 从iPhone应用程序导入本地日历的可能性
- 12. 如何从iPhone应用程序添加事件到谷歌日历?
- 13. 如何在我的iPhone应用程序中使用日历?
- 14. 如何将iPhone笔记导入我的应用程序?
- 15. 如何从我的应用程序中打开iPhone日历?
- 16. 将多个事件导入Android日历
- 17. 如何通过我的应用程序将事件设置为设备日历?
- 18. ASP.Net日历/事件应用程序
- 19. 如何使用java将CSV日历导入到我的Google日历中
- 20. 如何将Google日历嵌入到我的GWT应用程序中?
- 21. 如何将Iphone中的库中的VIDEO导入到我的应用程序中?
- 22. 在Android中删除应用程序插入的日历事件
- 23. 如何将iPhone联系人/日历与我的PHP应用程序集成?
- 24. 同步iPhone日历事件删除与事件存储在应用程序
- 25. 如何将Excel工作表数据导入到我的iphone应用程序中。
- 26. 如何从iPhone应用程序中启动iPhone日历?
- 27. 添加事件与我的应用程序日历IOS7
- 28. 如何将数据库导入到我的iphone程序中?
- 29. 如何将事件iphone添加到日历
- 30. 将Django json导入iPhone应用程序
可能重复[编程方式在iPhone日历中添加自定义事件](HTTP://计算器.COM /问题/ 246249 /的程序化LY-插件自定义事件中最iphone日历) – 0xDE4E15B 2012-04-12 10:10:06