Question

I have my ALAssetsGroup object. For example:

ALAssetsGroup *_someGroup.

But user can send the application to background and delete this album.

Is there any check if assetsGroup is proper?

[_someGroup numberOfAssets] returns the *old number of photos* even when the group doesn't exist

[_someGroup enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop)

CRASHES::

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSOrderedSetM getObjects:range:]: range {0, 1} extends beyond bounds for empty ordered set'


ALAssetsGroup has also valueForProperty: method, where i can get ALAssetsGroupPropertyURL (Key to retrieve a URL that uniquely identifies the group). So i can enumerate all albums and check if some album with the same property exists. But it is available only in iOS 5.

Was it helpful?

Solution

I found the solution: ALAssetsGroupPropertyPersistentID property works as I expected.

So I can enumerate through the albums and check if they have the same ID.

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