ios - "The app' s Info.plist 必须包含 NSPhotoLibraryAddUsageDescription 的崩溃是什么?

标签 ios permissions ios11

我遇到了以下错误(iOS 11):

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.

请注意,尽管应用程序 info.plist 确实包含 NSPhotoLibraryUsageDescription,但它仍然会崩溃,这是为什么?

最佳答案

Note that although the application info.plist does contains NSPhotoLibraryUsageDescription it still crashes, why?

我认为在比较 NSPhotoLibraryUsageDescriptionNSPhotoLibraryAddUsageDescription 时存在误解,如 Information Property List Key Reference 中所述:

NSPhotoLibraryUsageDescription:

This key lets you describe the reason your app accesses the user’s photo library. When the system prompts the user to allow access, this string is displayed as part of the alert.

这与让应用能够访问(获取)设备照片库有关。

NSPhotoLibraryAddUsageDescription:

This key lets you describe the reason your app seeks write-only access to the user’s photo library. When the system prompts the user to allow access, this string is displayed as part of the alert.

这与让应用能够写入(添加)照片到设备照片库有关。


显然,要解决此崩溃,您必须将 NSPhotoLibraryAddUsageDescription 添加到应用程序的 plist 文件中:

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Our application needs permission to write photos...</string>

作为属性 ListView :

enter image description here

关于ios - "The app' s Info.plist 必须包含 NSPhotoLibraryAddUsageDescription 的崩溃是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46681344/

相关文章:

ios - UITextField/UILabel 和下面的按钮之间的间隙(Xcode Storyboard)

php - 应用 Magento SUPEE 6285 后拒绝访问

objective-c - 以用户身份运行的守护进程无人需要从桌面复制文件

html - WKWebView 从文档目录加载 html 在设备上不起作用

ios - UITableView 高度等于 contentSize 高度

iphone - iOS 无法在 UITableViewCell 中设置 UITextField 文本属性

ios - 用于卡模拟的 CoreNFC?

ios - AGX : Texture read/write assertion failed: height > 0

ios - 仅保存最后一项,同时保存在核心数据 swift 中

html - 浏览器应用程序和本地文件系统访问