iOS 10 : sharing image/save image started crashing

标签 ios share uiactivityviewcontroller

我有一个通过 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/

相关文章:

javascript - 在 window.location 中使用 JS 变量

ios - UIActivityViewController 中的 "Assign to contact"不工作...!

ios - UIActivityItemProvider 返回多个对象还是什么都不返回?

ios - 用 SLRequest 替换 UIActivityViewController 推特帖子操作

ios - 未定义不是对象(评估 RNRandomBytes.seed)

ios - 当 func 中的归档对象编码时(使用 aCoder : NSCoder) method crashed with swift enum in real revice

ios - Swift:在共享容器 View 中更新标签

iphone - 如何使用 Game Center 仅使用 wifi 玩游戏?

java - 将其他应用程序的图像共享到我的应用程序