I noticed that although I set the pointer *stop BOOLto YES, my enum block is executed twice. I thought the installation *stop = YESwould stop after the first?
[lib enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
NSLog(@"Enumerating a group");
*stop = YES;
} failureBlock:^(NSError *error) {
}];
Magazines:
2014-03-05 12:27:29:363 AppName[3625:1547] Enumerating a group
2014-03-05 12:27:29:379 AppName[3625:1547] Enumerating a group
From the documentation, it -enumerateGroupsWithTypes:usingBlock:is asynchronous, but also does it automatically parallelize? Both enumerations happen in the main thread, so maybe I should do my own stop? It seems strange to suggest stopif it is not fully respected in the way the documentation suggests.
EDIT
For what it's worth, I added my own coercion, and it works. But why do I need this?
__block BOOL stopItForReal = NO;
[lib enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
NSLog(@"Enumerating a group");
//does not stop enumeration
*stop = YES;
//actually stops enumeration. I win, runtime!
if (stopItForReal)
return;
stopItForReal = YES;
} failureBlock:^(NSError *error) {
}];