需要 NSPhotoLibraryAddUsageDescription 但已在 plist.info
NSPhotoLibraryAddUsageDescription required but already in the plist.info
我使用带有 UIGraphicsGetImageFromCurrentImageContext() 的屏幕捕获代码,然后使用 UIActivityViewController 允许用户select如何处理屏幕截图图像
一切正常,但当我点击保存图像时,出现控制台错误:
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.
我检查了 plist.info,其中已经列出了 NSPhotoLibraryAddUsageDescription
那么为什么它不识别它并且仍然报错?
我尝试删除派生数据并清理构建文件夹。
如果密钥是 NSPhotoLibraryAddUsageDescription
,而不是 NSPhotoLibraryUsageDescription
,请再次检查 plist。
将此密钥添加到 plist 并请求许可的 Apple 文档:
https://developer.apple.com/documentation/bundleresources/information_property_list/protected_resources/requesting_authorization_to_access_photos
我使用带有 UIGraphicsGetImageFromCurrentImageContext() 的屏幕捕获代码,然后使用 UIActivityViewController 允许用户select如何处理屏幕截图图像
一切正常,但当我点击保存图像时,出现控制台错误:
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.
我检查了 plist.info,其中已经列出了 NSPhotoLibraryAddUsageDescription
那么为什么它不识别它并且仍然报错?
我尝试删除派生数据并清理构建文件夹。
如果密钥是 NSPhotoLibraryAddUsageDescription
,而不是 NSPhotoLibraryUsageDescription
,请再次检查 plist。
将此密钥添加到 plist 并请求许可的 Apple 文档: https://developer.apple.com/documentation/bundleresources/information_property_list/protected_resources/requesting_authorization_to_access_photos