ALAssetsLibrary ALAssetsLibraryDataUnavailableError 错误

发布于 2024-12-18 11:28:41 字数 250 浏览 2 评论 0原文

我正在努力确保涵盖有关 ALAssetsLibrary 由于任何原因失败的所有基础。在查看调用时可能发生的错误时:

- (void)enumerateGroupsWithTypes:usingBlock:failureBlock;

我注意到 ALAssetsLibraryDataUnavailableError,但没有太多关于可能导致此问题的信息。我想相应地显示错误屏幕。

任何见解将不胜感激。谢谢!

I'm trying to make sure to cover all my bases with regard to ALAssetsLibrary failing for whatever reason. In looking through the possible errors that could occur when calling:

- (void)enumerateGroupsWithTypes:usingBlock:failureBlock;

i noticed that ALAssetsLibraryDataUnavailableError, but there isn't much information about what might cause this. I want to show an error screen accordingly.

Any insight would be appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

橘虞初梦 2024-12-25 11:28:42

我在 3 种情况下遇到了 ALAssetsLibraryDataUnavailableError:

  1. 使用模拟器以及在 iPhone 和 iPad 模拟器之间切换时。
  2. 在设备上,当照片库损坏或处于不一致状态时。
  3. 在未同步到 iTunes 的情况下执行 iOS 升级后。

我建议向用户显示一条消息,您遇到此错误,建议:
1. 打开照片应用程序...这通常可以修复不一致的库。
2. 如果这不起作用,请重新启动设备并与 iTunes 同步一次。

干杯,

亨德里克

I encountered the ALAssetsLibraryDataUnavailableError in 3 cases:

  1. When using the simulator and switching between iPhone and iPad simulator.
  2. On the device, when the photo library was corrupt or in an inconsistent state.
  3. After performing an iOS upgrade without having synced to iTunes.

I would recommend to display a message to the user, you run into this error, recommending:
1. To open the photos app...this usually fixes an inconsistent library.
2. If that doesn't help to reboot the Device and sync with iTunes one time.

Cheers,

Hendrik

溺深海 2024-12-25 11:28:42

好吧,我发现出现此错误的另一个特殊情况:

  • 尝试使用 UIImageWriteToSavedPhotosAlbum 将 UIImage 保存到相册/相册。
  • iOS 请求用户访问照片库的权限 - 用户拒绝(!)

在completionSelector 中,提供的 NSError 然后包含 ALAssetsLibrary ALAssetsLibraryDataUnavailableError。

您可能会认为该错误可能是 ALAssetsLibraryAccessUserDeniedError 或 ALAssetsLibraryAccessGloballyDeniedError 之类的其他错误。但事实并非如此。这只是 ALAssetsLibraryDataUnavailableError。

这是在 iPhone 5、iOS 6.0.1 上测试的。也许这不是一个错误,或者是,他们有一天会修复它。

无论如何,“修复”是让用户进入“设置”→“隐私”→“照片”→在此处打开您的应用程序。本地化修复建议消息是错误的 - 它建议打开“照片”应用程序。没有给出有关错误的其他信息。无论如何,用户可能应该知道他/她按下了“拒绝”按钮 - 他们仍然可能错误地这样做了,后来他们不知道发生了什么。

Ok I found out another peculiar circumstance where this error appears:

  • Trying to save an UIImage to photo roll/photo album using UIImageWriteToSavedPhotosAlbum.
  • iOS asks the user for permission to access the photo library - the user denies(!)

In the completionSelector, the supplied NSError then contains ALAssetsLibrary ALAssetsLibraryDataUnavailableError.

You would think that the error would be something else like ALAssetsLibraryAccessUserDeniedError or ALAssetsLibraryAccessGloballyDeniedError. But it's not. It's just ALAssetsLibraryDataUnavailableError.

This was tested on iPhone 5, iOS 6.0.1. Maybe it's not an error, or it is and they will fix it someday.

Anyway, the "fix" is to have the user go into Settings→Privacy→Photos→have your app turned on here. The localized fix suggestion message is WRONG - it suggest to open the Photos app. No other information about the error given. Anyway, the user should probably know that he/she pushed the "Deny" button - still they might have done so by mistake and later they would have no idea what is going on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文