var eventStore: EKEventStore?
@IBAction func bbbbbbb(sender: UIButton) {
if eventStore == nil {
eventStore = EKEventStore()
}
self.eventStore?.requestAccessToEntityType(EKEntityType.Event, completion: { (aBool, error) -> Void in
print(error, aBool)
})
}
the print is nil, false always... Its behaving like the user has already denied access, but the promt is never being showed. The same code of course works in a new blank app on the same devices. Things I have tried: resting setting on device, simulator and using a new device where the app has never been installed and of course cleaning the project, but with no success. Plus in the app settings the calendar permission is not showing as well. Any ideas of what is going on?
With iOS 10, you need to add the following key in your plist to allow an app to access the calendar (if not, the app will simply crash when requesting access):
key: "Privacy - Calendars Usage Description"
value: "$(PRODUCT_NAME) calendar events"
see here:
https://iosdevcenters.blogspot.com/2016/09/infoplist-privacy-settings-in-ios-10.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With