iOS 10.1.1开发适配崩溃,通讯录、麦克风、相机和照片权限问题

更新Xcode 8.1之后,运行模拟机的时候崩溃,控制台给我一串信息:
[access] 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里边需要
1、在Info.plist 中添加NSCameraUsageDescription 类型 string。
2、后边的描述可以随意写。
或者
1.在项目中找到info.plist文件,右键点击以 Source Code形式打开
2.添加以下键值对,这里以 PhotoLibrary 作为例子

1-1.png
// 相机
<key>NSCameraUsageDescription</key> <string>cameraDesciption</string>
// 照片
<key>NSPhotoLibraryUsageDescription</key<string>photoLibraryDesciption</string>
// 通讯录
<key>NSContactsUsageDescription</key> <string>contactsDesciption</string>
// 麦克风
<key>NSMicrophoneUsageDescription</key> <string>microphoneDesciption</string>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容