iOS10 權限崩潰問題

手機升級了 iOS10,然後用正在開發的項目 裝了個ipa包,發現點擊有關 權限訪問 直接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,分別複製 以下 Value 和Key,Key 一定不能錯,Value 貌似可以隨便填寫

相機權限描述:

<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>

通信錄:

<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>

麥克風:

<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>

相機:

<key>NSPhotoLibraryUsageDescription</key>
<string>photoLibraryDesciption</string>

eg:其他權限描述,debug 控制檯都會有輸出的,自行添加就OK

3,在info.plist 文件上 複製上,然後 保存,如下圖:

Source Code 的形式:


20160614172110952.jpeg


Property List 的展現形式:


20160614172211047.jpeg

4,Clean之後,運行就OK了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章