iOS10 权限访问崩溃
手機(jī)升級(jí)了 iOS10 Beta,然后用正在開發(fā)的項(xiàng)目 裝了個(gè)ipa包,發(fā)現(xiàn)點(diǎn)擊有關(guān) 權(quán)限訪問(wèn) 直接Crash了,并在控制臺(tái)輸出了一些信息:
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.
意思是說(shuō):你需要在info.plist文件 添加一個(gè)“NSContactsUsageDescription ”的Key,Value添加一個(gè)描述。
1,在項(xiàng)目中找到info.plist文件,右擊有個(gè) Open As,以Source Code 的形式打開
2,分別復(fù)制 以下 Value 和Key,Key 一定不能錯(cuò),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 控制臺(tái)都會(huì)有輸出的,自行添加就OK
3,在info.plist 文件上 復(fù)制上,然后 保存,如下圖:
Source Code 的形式:
20160614172110952.jpeg
Property List 的展現(xiàn)形式:
20160614172211047.jpeg
4,Clean之后,運(yùn)行就OK了
文/John_LS(簡(jiǎn)書作者)
原文鏈接:http://www.jianshu.com/p/83db0b4f0bfe
著作權(quán)歸作者所有,轉(zhuǎn)載請(qǐng)聯(lián)系作者獲得授權(quán),并標(biāo)注“簡(jiǎn)書作者”。
總結(jié)
以上是生活随笔為你收集整理的iOS10 权限访问崩溃的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: xcode8 升级后注释快捷键不能使用的
- 下一篇: ApplePay集成教程