2016-11-24 92 views
0

我的代碼: EKEventStore訪問請求崩潰:應用程序的Info.plist必須包含一個NSRemindersUsageDescription關鍵

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

}]; 

該應用程序的Info.plist 已經包含NSRemindersUsageDescription key and 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. 

回答

2

ios10

您應該在您的Info.plist中加入NSRemindersUsageDescriptionaccess configuration list

方法1)如果打開Xcode中的info.plist,請按照以下圖片:

a.click的Info.plist

click Info.plist

b.click添加按鈕

click the add button

c。設置鍵NSRemindersUsageDescription

set the rescribe name

d.fill值爲什麼您的應用程序需要用戶的這個權限

fill the value why your app need user’s this permission

編輯

如果您在Info.plist添加NSRemindersUsageDescription,然後出現error,您添加NSRemindersUsageDescriptionTARGET這樣的,有一個嘗試:

add describe in target

方法2)如果您在源代碼中打開info.plist

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

我的應用程序的Info.plist已經包含NSRemindersUsageDescription,但在iOS 10上它崩潰了。 –

+0

@王先生好吧,那麼'錯誤'日誌是你的問題'日誌信息'呢? – aircraft

相關問題