2017-08-31 4 views
1

のインポート中に私のようなコードを持っている:iOSの10、calendar.title空のタイトル

let calendars = EKEventStore().calendars(for: entityType) 

for calendar in calendars { 
    ... 
    createListFrom(calendar: calendar, entityType: entityType) 
} 

... 

newList.name = calendar.title 

を本当の名前ですが、iOSの11でそれは常にnilです。

iOS 11のバグですか、何か間違っていますか?

upd。 。

バリアント

せeventStore = EKEventStore()

カレンダーの=はeventStore.calendars(みましょう:

問題がカレンダー= EKEventStore()しましょう(entityType用)カレンダーを

であります.event)

作品

答えて

0

カレンダーの場合は、以下のコード行を使用します。

var calenders: [EKCalendar]? 
let eventStore = EKEventStore(); 

func fetchCalendarEvents(){ 
calenders = eventStore.calendars(for: .event) 
for calendar in calenders!{ 
    print(calendar.title) 
} 
} 
+0

私は正確に同じコードを使用します。 –

+0

あなたは許可を求めましたか? –

+0

はい、コードはiOS 10で動作します –