美文网首页iOS
iOS This app has crashed because

iOS This app has crashed because

作者: NieFeng1024 | 来源:发表于2017-01-20 13:18 被阅读66次

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an(报错的权限KEY) NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

控制台打印类似的报错信息都是因为权限问题,没有经过用户许可使用某些权限,如相机。。

解决方案

  1. 打开info.plist
    添加一个选项
    键 - NSPhotoLibraryUsageDescription
    值 String- 随意填写会显示在第一次调用次权限的alert view的子标题中。

  2. 打开info.plist source code
    添加一下键值对
    <key>NSPhotoLibraryUsageDescription</key>
    <string>App 需要您的同意才能读取媒体资料库</string>

相关文章

网友评论

    本文标题:iOS This app has crashed because

    本文链接:https://www.haomeiwen.com/subject/tabwbttx.html