无法在OSx中访问EKEventStore

时间:2013-02-02 01:38:01

标签: osx-lion ekeventstore

我尝试使用EKEventStore检查web和引用中的文档。但仍然有下面的问题似乎我无法访问OSx中的商店。我的是10.7.5,请帮忙说明我做错了。

#import "AppDelegate.h" 
@implementation AppDelegate
@synthesize store = _store;
@synthesize defaultCalendar = _defaultCalendar;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
    self.store = [[EKEventStore alloc] initWithAccessToEntityTypes:EKEntityTypeEvent];
    self.defaultCalendar  = [self.store defaultCalendarForNewEvents];
}

- (IBAction)startPress:(id)sender {
    NSLog(@"Default calendar:%@ is nil:%@", [self.defaultCalendar title],(self.defaultCalendar));
    NSArray *calendars = [self.store calendarsForEntityType:EKEntityTypeEvent];
    NSLog(@"Total calendars %lu", calendars.count);
}

这是Log

中出现的结果

2013-02-02 08:24:42.429 iCalendarProfiler-Test01152013 [2296:403]默认日历:( null)为零:( null) 2013-02-02 08:24:42.429 iCalendarProfiler-Test01152013 [2296:403]总日历0

1 个答案:

答案 0 :(得分:0)

OS X的EKEventStore自10.8起可用,不适用于OS X 10.7.5