我是iPhone開發新手。 有一個在我的應用程序的要求,其中,有一個Web服務鏈接,低於:在默認日曆中添加特定日期作爲事件
http://01s.in/webservices/sikhcalendar/getData.php?db_table=cal
所以我想,這是在鏈接顯示的特定日期,該日期應在iCal中添加這些都是在我的應用程序中添加的。並且它應該在該特定的日子生成警報視圖。
所以,我沒有得到如何在iCal中添加事件。請給我一些這個答案。
在此先感謝。
我是iPhone開發新手。 有一個在我的應用程序的要求,其中,有一個Web服務鏈接,低於:在默認日曆中添加特定日期作爲事件
http://01s.in/webservices/sikhcalendar/getData.php?db_table=cal
所以我想,這是在鏈接顯示的特定日期,該日期應在iCal中添加這些都是在我的應用程序中添加的。並且它應該在該特定的日子生成警報視圖。
所以,我沒有得到如何在iCal中添加事件。請給我一些這個答案。
在此先感謝。
將在iCal日期首先你要在你的代碼添加兩個框架即EventKit/EventKit.h
,EventKitUI/EventKitUI.h
和符合的類EKEventEditViewDelegate
委託,並使用下面的方法來在iCal
- (void)eventEditViewController:(EKEventEditViewController *)controller didCompleteWithAction:(EKEventEditViewAction)action
和我建議你去通過this url,瞭解這些框架
在默認日曆添加事件可以做到使用下面的函數
-(void)createEvent :(NSString *)eventTitle: (NSURL *)eventURL: (NSString *)eventNotes: (NSDate *)eventStartDate: (NSDate *)eventEndDate{
EKEventStore *eventStore = [[EKEventStore alloc] init];
EKEvent *event = [EKEvent eventWithEventStore:eventStore];
event.title = eventTitle;
event.URL = eventURL;
event.notes = eventNotes;
event.startDate = eventStartDate;
event.endDate = eventEndDate;
[event setCalendar:[eventStore defaultCalendarForNewEvents]];
EKAlarm *myAlarm = [EKAlarm alarmWithRelativeOffset:0];
[event addAlarm:myAlarm];
NSError *err;
BOOL success = [eventStore saveEvent:event span:EKSpanThisEvent error:&err];
NSLog(@"event created success if value = 1 : %d", success);}
這裏eventStartDate會的時候,你設置報警被執行,你會得到一個通知
[如何使用事件Kit框架在iPhone添加事件(HTTP的
可能重複: //stackoverflow.com/questions/6530687/how-to-add-events-in-iphone-using-event-kit-framework) –