Problems accessing Calendar using EKEventStore on OSX Sierra with Swift 3
You need to add a usage description to your info.plist. This is a small description of why you need access to the services that is presented to the user.
<key>NSCalendarsUsageDescription</key>
<string>Description of why you need access to the Calendar</string>
eventStore.saveCalendar returns an error json error: An unexpected error occurred.
Two possible reasons
From the documentation of EKEventStore
To access the user’s Calendar data, all sandboxed macOS apps must include the
com.apple.security.personal-information.calendars
entitlement. To learn more about entitlements related to App Sandbox, see Enabling App Sandbox.Check the authorizationStatus of the store and call requestAccess if necessary.
Your error message is misleading, the error has nothing to do with JSON.
iOS: EKEventStore sources / defaultCalendarForNewEvents / calendarsForEntityType all return nothing AFTER authorization
OK, it turns out there was a small line of code in a viewDidLoad that was before the [eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error
code and that tried to access the eventStore. It was superfluous and did not need to be happening and I had not noticed it. Once I removed this code the stuff now works, so it does go back to needing to authorize, as even after authorization, the eventStore was already "bad" due to this previous access.
Related Topics
Apple Vision - Barcode Detection Doesn't Work for Barcodes with Different Colours
Nested Tabview - Remove Inner Tab Bar iOS 13, Swift Ui
How to Place Objects with Hit Test Without Plane Detection
How to Create Project Without Story Board in Xcode 6 (Swift)
Content Blocker Extension with a String Instead of a File
Nstimer Not Stopping When Invalidated in This Function
Using a Metal Shader in Scenekit
Uiswipegesturerecognizer Doesn't Recognize Swipe Gesture Initiated Outside the View
How to Make a Button Draggable/Movable with Swiftui