我有一个通过 UIActivityViewController 共享一行文本和一个图像的代码。在我更新到 iOS 10 后,它开始崩溃并显示以下日志:
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
我不会发布代码,因为即使在苹果自己的示例中似乎也会发生这种情况。我找到了对应的radar ,但不是 StackOverflow 主题。
希望它能节省某人的时间。修复方法是将该行添加到您的 plist 中,即使应用程序本身不与照片库交互。如果有人找到更好的解决方案,那就太好了。
请注意,它与problem with UIImagePickerController不同。 - 它接近于相反的 Action 。
最佳答案
将 NSPhotoLibraryUsageDescription 添加到 Info.plist :-( 不要将其留空 - 它会重用 Apple 的默认问题,但仅适用于开发。将此类存档上传到 App Store 将触发错误。
关于iOS 10 : sharing image/save image started crashing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39678071/