Having trouble with eventWithUID:occurrence: CalCalendarStore method
Having trouble with eventWithUID:occurrence: CalCalendarStore method
- Subject: Having trouble with eventWithUID:occurrence: CalCalendarStore method
- From: "Mazen M. Abdel-Rahman" <email@hidden>
- Date: Tue, 08 Jun 2010 10:19:32 -0700
Hi All,
The eventWithUID:occurrence: method of CalCalendarStore is not working for me as expected when retrieving a recurring event. I am not sure if there is a disconnect between the documentation and the CalCalendarStore documentation or if perhaps there is something I am not seeing.
According to the documentation for the return value:
A CalEvent object that matches the specified unique identifier and date. Returns nil if the event is not found, or the event is recurring and date is not specified.
However - I am always getting back the first event of a recurring series if I give it the uid of a recurring event with out a date. I am not getting back nil as I should be according to the documentation.
Here is some simple test code:
CalCalendarStore * calStore = [CalCalendarStore defaultCalendarStore];
NSDate * today = [NSDate date];
NSDate * start = [today dateByAddingTimeInterval:(60*60*24)];
NSDate * end = [today dateByAddingTimeInterval:(60*60*28)];
NSPredicate * predicate = [CalCalendarStore eventPredicateWithStartDate:start endDate:end calendars:[calStore calendars]];
NSArray * events = [calStore eventsWithPredicate:predicate];
CalEvent * event = [events objectAtIndex:0];
NSString * title = [event title];
NSString * uid = [event uid];
NSLog(@"%@ %@", title, uid);
CalEvent * eventWithUID = nil;
eventWithUID = [calStore eventWithUID:uid occurrence:nil];
NSLog(@"Event is %@", eventWithUID);
In my case I am retrieving exactly one event of a recurring series. eventWithUID should be null - but it is not. Is anyone familiar with this problem - and is this already a documented issue? Or has my brain frozen over and perhaps there's something I'm not seeing or understanding properly?
Thanks!
Mazen Abdel-Rahman
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden