有没有办法从自定义应用程序中将iCal事件添加到iPhone日历?
我需要向用户日历添加一个事件.
所以我得到他所有的日历:
let calendars = store.calendarsForEntityType(EKEntityTypeEvent)
as [EKCalendar]
Run Code Online (Sandbox Code Playgroud)
我有一些问题:
谢谢
我的代码:
EKEventStore* eventStore = [[EKEventStore alloc] init];
[eventStore requestAccessToEntityType:EKEntityTypeReminder
completion:^(BOOL granted, NSError * _Nullable error) {
}];
Run Code Online (Sandbox Code Playgroud)
应用程序的 Info.plist已经包含一个NSRemindersUsageDescription键和NSCalendarsUsageDescription键,但下面的代码在 iOS 8 和 9 上工作正常,但在 iOS 10 上它崩溃了。像:
[access] This app has crashed because it attempted to access
privacy-sensitive data without a usage description.
The app's Info.plist must contain an NSCalendarsUsageDescription key
with a string value explaining to the user how the app uses this data.
Run Code Online (Sandbox Code Playgroud)