2

I want to create a EKEvent in calendar with forever repeat option. Below is the code for the Recurrence rule

  EKRecurrenceRule *rule = [[EKRecurrenceRule alloc] 
                            initRecurrenceWithFrequency:EKRecurrenceFrequencyDaily 
                            interval:1
                            end:[EKRecurrenceEnd recurrenceEndWithEndDate:date]];

how to set infinite or never end in recurrence end argument.

Thanks

2 Answers2

4

little late, but i 'll answer, because i could not find the answer anywhere in the Apple Doc. Just pass nil as end param and there you go. Calender sets the end of the event to infinite.

EKRecurrenceRule *rule = [[EKRecurrenceRule alloc] 
                        initRecurrenceWithFrequency:EKRecurrenceFrequencyDaily 
                        interval:1
                        end:[EKRecurrenceEnd recurrenceEndWithEndDate:nil]];

The calender creates recurrence events for 2 years and then adds them on demand.

greets

scrat84
  • 185
  • 1
  • 8
  • recurrenceEndWithEndDate nil won't work. From Apple Docs: "The end date argument must be a valid NSDate and not nil; otherwise an exception will be raised." – kabucey Aug 30 '13 at 21:57
  • if I want to set repetition every 2 week then how to make it possible using above code. Can any one help me? – kb920 Aug 25 '14 at 05:24
  • 1
    I got solution just pass 2 instead of 1 in "interval" parameter.That's it – kb920 Aug 25 '14 at 05:31
2
EKRecurrenceRule *rule = [[EKRecurrenceRule alloc] 
                        initRecurrenceWithFrequency:EKRecurrenceFrequencyDaily 
                        interval:1
                        end:nil];

just pass nil to the end so that it repeats all over. Have a happy Coding.