Enumerating Asset Groups and Assets

A common design pattern when dealing with ALAssetsLibrary is enumeration. Because the user’s permission is required to access asset groups and assets, you typically need to enumerate the groups and assets to put them in a data structure to use in your user interface. The sample app will enumerate the groups on the device first to gather information about them to present in ICFAssetLibraryViewController. To do this, create an instance of ALAssetsLibrary, and then call the method to enumerate groups.

ALAssetsLibrary *al =[[[ALAssetsLibrary alloc] init] autorelease];...[al enumerateGroupsWithTypes:ALAssetsGroupAll                  usingBlock:enumerateAssetGroupsBlock                 ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.