アプリで通知付きのアラームを設定する必要があります。次のコードを試しましたが、うまくいきません
EKEventStore * eventStore1 = [[EKEventStore alloc] init];
if([eventStore1 respondsToSelector:@selector(requestAccessToEntityType:completion:)]) {
[eventStore1 requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
// This code will run when uses has made his/her choice
EKEvent *event = [EKEvent eventWithEventStore:eventStore1];
NSDate * date = [NSDate date];
NSLog(@"%@",date);
event.title = @"HAIManiiiiii";
event.location = @" ";
event.startDate = date;
event.endDate = [[[NSDate alloc] initWithTimeInterval:36 sinceDate:event.startDate] autorelease];
EKRecurrenceRule *rule = [[EKRecurrenceRule alloc]
initRecurrenceWithFrequency:EKRecurrenceFrequencyYearly
interval:1
end:[EKRecurrenceEnd recurrenceEndWithOccurrenceCount:10]];
EKAlarm *alarm1 = [EKAlarm alarmWithRelativeOffset:-36];
NSArray * ruleArray = [[NSArray alloc]initWithObjects:rule, nil];
NSArray * alrmArray = [[NSArray alloc] initWithObjects: alarm1, nil];
event.alarms = alrmArray;
event.recurrenceRules = ruleArray;
[event setCalendar:[eventStore1 defaultCalendarForNewEvents]];
NSError *err;
// [eventStore1 saveEvent:event span:EKSpanThisEvent error:&err];
NSLog(@"%d",[eventStore1 saveEvent:event span:EKSpanThisEvent error:&err]);
NSLog(@"Error From iCal : %@", [err description]);
}]
イベントがカレンダーに追加されていますが、うまくいきません。この問題を解決するためのアイデアを教えてください