При добавлении календаря на снимке экрана выше: Error Domain=EKErrorDomain Code=14 «Календарь не имеет источника»
Код:
Код: Выделить всё
EKCalendar *customCalendar = [EKCalendar calendarForEntityType:EKEntityTypeEvent eventStore:eventStore];
customCalendar.CGColor = UIColor.blueColor.CGColor;
NSArray *sources = eventStore.sources;
EKSource *selectedSource;
BOOL notFind = YES;
for (EKSource *source in sources) {
if (source.sourceType == EKSourceTypeLocal || (source.sourceType == EKSourceTypeCalDAV && [source.title.lowercaseString containsString:@"icloud"])) {
selectedSource = source;
break;
}
}
if (selectedSource) {
customCalendar.source = selectedSource;
}else {
customCalendar.source = eventStore.defaultCalendarForNewEvents.source;
}
NSError *error = nil;
[eventStore saveCalendar:customCalendar commit:YES error:&error];
Код: Выделить всё
[{
"Subscribed Calendars": [
{
"title": "中国大陆节假日",
"type": 3,
"immutable": "0",
"allow": "0"
},
{
"title": "Malaysia Holidays",
"type": 3,
"immutable": "0",
"allow": "0"
}
]
},
{
"Other": [
{
"title": "生日",
"type": 4,
"immutable": "1",
"allow": "0"
}
]
}
]
обычный скриншот
Подробнее здесь: https://stackoverflow.com/questions/798 ... -no-source
Мобильная версия