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