我遇到了以下错误(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?
我认为在比较 NSPhotoLibraryUsageDescription
和 NSPhotoLibraryAddUsageDescription
时存在误解,如 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 :
关于ios - "The app' s Info.plist 必须包含 NSPhotoLibraryAddUsageDescription 的崩溃是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46681344/