This card is not difficult to work with, but it is tedious because it loads properties asynchronously / lazy, and KVO is the only one who wants to receive async completion notification.
If you want to iterate photos, you do not need to know identifiers in advance.
Create a media library:
self.library = [[MLMediaLibrary alloc] initWithOptions:options];
Add KVO Observer for mediaSources . Get access to media resources, if not zero, go to the next step, otherwise go to the next step when your KVO observer is triggered.
In the next step, iterating over the sources, adding a KVO observer to rootMediaGroup and rootMediaGroup each source. If it is not equal to zero, call your iterator now, otherwise call it from the KVO notification handler.
For each rootMediaGroup, follow the same strategy as above, but for mediaObjects . Media objects are what you end up after.
source share