iPhone Calendar. Domain=EKErrorDomain Code=14 "Calendar has no source\"
iOS add calendar– Error Domain=EKErrorDomain Code=14 "Calendar has no source"
An error occurred when adding a calendar in the screenshot above: Error Domain=EKErrorDomain Code=14 "Calendar has no source\"
Code:
// Source - https://stackoverflow.com/q/79882772
// Posted by user7076003, modified by community. See post 'Timeline' for change history
// Retrieved 2026-02-05, License - CC BY-SA 4.0
EKCalendar *customCalendar = [EKCalendar calendarForEntityType:EKEntityTypeEvent eventStore:eventStore];
customCalendar.CGColor = UIColor.blueColor.CGColor;
NSArray<EKSource *> *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];
User Calendar Source:
; Source - https://stackoverflow.com/q/79882772
; Posted by user7076003, modified by community. See post 'Timeline' for change history
; Retrieved 2026-02-05, License - CC BY-SA 4.0
[{
"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"
}
]
}
]
Why is there no "Local" or "iCloud" calendar source?
iPhone 15 Pro, iOS 26