iOS10 權限崩潰問題-b


手機升級了 iOS10 Beta,然后用正在開發的項目 裝了個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了



文/John_LS(簡書作者)
原文鏈接:http://www.jianshu.com/p/83db0b4f0bfe
著作權歸作者所有,轉載請聯系作者獲得授權,並標注“簡書作者”。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM