ALAssetsGroup becomes invalid

I use the AssetsLibrary structure to save assets in a specific album ( ALAssetsGroup ).

Since I often use ALAssetsGroup (for an album where I want to save assets), I decided that it would be wise to save it, so I do not need to repeat (asynchronously) groups every time I need it.

When receiving / creating an album, everything is displayed correctly (for valueForProperty: , but after some time the group ceases to act, and all its properties will return nil . In addition, addAsset: will not work on it, so I will have to search for the album again (this time it searched by its URL, but it is still asynchronous).

Is there any way around this (to save ALAssetsGroup )?

This happens on iOS 5, and the library ( ALAssetsLibrary ) is saved. I use the setter to make sure that I do not reset group myself.

+4
source share
1 answer

You need to add an observer for ALAssetsLibraryChangedNotification for your ALAssetsLibrary and after receiving a request for a second request for any of your cached AL * objects. This will be published just before the modified AL * objects become invalid.

+4
source

All Articles