Well, it looks like the SDK does not provide me with anything that I can use to check if EKEvent is read-only. I created a workaround by creating a category that adds the isReadOnly method to all EKEvent instances.
EKEvent + ReadOnlyCheck.h
@interface EKEvent(ReadOnlyCheck)
- (BOOL) isReadOnly;
@end`
EKEvent + ReadOnlyCheck.m
#import "EKEvent+ReadOnlyCheck.h"
@implementation EKEvent(ReadOnlyCheck)
- (BOOL) isReadOnly {
BOOL readOnly;
NSString *originalTitle = [self.title retain];
NSString *someRandomTitle = [NSString stringWithFormat:@"%i", arc4random()];
self.title = someRandomTitle;
readOnly = [originalTitle isEqualToString:self.title];
self.title = originalTitle;
[originalTitle release];
return readOnly;
}
@end
When the above files are in place, I can simply call isReadOnlyin EKEvent of my choice.
#import "EKEvent+ReadOnlyCheck.h"
...
if ([event isReadOnly]) {
}
...
source
share