1

WebとリファレンスのドキュメントをチェックしながらEKEventStoreを使用しようとしています。しかし、それでも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);
}

これはログに出てきた結果です

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

4

1 に答える 1