關於iOS10 獲取權限導致Crash問題的解決辦法


今天 手機升級了 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 貌似可以隨便填寫

 相機權限描述:

NSCameraUsageDescription
cameraDesciption

通信錄:
NSContactsUsageDescription
contactsDesciption

麥克風:
NSMicrophoneUsageDescription
microphoneDesciption

相機:
NSPhotoLibraryUsageDescription
photoLibraryDesciption

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

3,在info.plist 文件上 復制上,然后 保存,如下圖:

Source Code 的形式:

Property List 的展現形式:

4,Clean之后,運行就OK了


免責聲明!

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



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