【发布时间】:2013-02-02 01:38:00
【问题描述】:
我尝试使用 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) 为 nil:(null) 2013-02-02 08:24:42.429 iCalendarProfiler-Test01152013[2296:403] 日历总数 0
【问题讨论】:
标签: osx-lion ekeventstore