今天 手機(jī)升級了 iOS10 Beta派继,然后用正在開發(fā)的項目 裝了個ipa包,發(fā)現(xiàn)點(diǎn)擊有關(guān) 權(quán)限訪問 直接Crash了仇奶,并在控制臺輸出了一些信息:
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
意思是說:你需要在info.plist
文件 添加一個NSContactsUsageDescription
的Key
貌嫡,Value
添加一個描述。
1. 在項目中找到info.plist
文件该溯,右擊有個 Open As岛抄,以Source Code
的形式打開
2. 分別復(fù)制 以下Value
和Key
,Key
一定不能錯狈茉,Value
貌似可以隨便填寫
相機(jī)權(quán)限描述:
<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
通信錄:
<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
麥克風(fēng):
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
相機(jī):
<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>
eg:其他權(quán)限描述夫椭,debug 控制臺都會有輸出的,自行添加就OK
3. 在info.plist
文件上 復(fù)制上氯庆,然后 保存蹭秋,如下圖:
Source Code 的形式:
Source Code
Property List 的展現(xiàn)形式:
Property List
4. Clean之后,運(yùn)行就OK了
轉(zhuǎn)自: