简体   繁体   中英

EKEventStore access request crashes on iOS 10. Message:The app's Info.plist must contain an NSRemindersUsageDescription key

My Code:

  EKEventStore* eventStore = [[EKEventStore alloc] init]; [eventStore requestAccessToEntityType:EKEntityTypeReminder completion:^(BOOL granted, NSError * _Nullable error) { }]; 

The app's Info.plist already contain an NSRemindersUsageDescription key and NSCalendarsUsageDescription key, but the code below works fine on iOS 8 and 9, but on iOS 10 it crashes .like:

  [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. 

In ios10 :

You should add NSRemindersUsageDescription access configuration list in your Info.plist :

Method 1) if you open your info.plist in Xcode, follow below images:

a.click Info.plist

点击Info.plist

b.click the add button

点击添加按钮

c. set the key NSRemindersUsageDescription

设置记录名称

d.fill the value why your app need user's this permission

填写您的应用为何需要用户获得此权限的值

EDIT

If you add the NSRemindersUsageDescription in your Info.plist , then appear the error , you add the NSRemindersUsageDescription in your TARGET like this, have a try:

在目标中添加描述

Method 2) if you open your info.plist in source code:

<key>NSRemindersUsageDescription</key>
<string>the describe of your need this permissions </string>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM