Question

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!

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top