EKEventStoreクラスにイベントストアのカレンダーオブジェクトの配列を返す@propertyNSArray* calendarsがあることは知っていますが、カレンダーのタイトルしかわからない場合は、その配列内の特定のカレンダーにアクセスする方法はありません。オンラインで見つけることができる唯一の例は、defaultCalendarForNewEventsにアクセスするプログラムですが、必要なカレンダーはデフォルトのカレンダーではありません。カレンダーの一意の識別子もわかりません。知っているのはタイトルだけです。valueForKeyメソッドを使用してBARTというタイトルのカレンダーにアクセスしようとしましたが、私が行っていることは間違いなく間違っています。誰か助けてもらえますか?これが私が試したことです:
@interface BARTClass:NSObject {
EKEventStore *eventStore;
EKCalendar *bart
NSArray *calendars;
}
@property(非アトミック、保持)EKEventStore * eventStore;
@property(nonatomic、retain)NSArray * calendars;
@property(非アトミック、保持)EKCalendar * bart;
-(EKCalendar)getBartCalendar;
@終わり
..。
@実装
@synthesizeカレンダー、バート、eventStore;
-(EKCalendar)getBartCalendar {
[self setEventStore: [[EKEventStore alloc] init]];
[self setCalendars = [eventStore calendars]];
NSArray *titles = [calendars valueForKey:@"title"];
[self setBart:[titles valueForKey:@"BART"]];
..。