I saw several people on SO have been using this code successfully. But I got the incompatible block pointer error:
Incompatible block pointer types initializing
void(^)(struct ALAssetsGroup *, BOOL *)
with an expression of type
void(^)(ALAsset *, NSUInteger, BOOL *)
Any hints? (EDIT with complete code)
ALAssetsLibrary *library =[[ALAssetsLibrary alloc]init];
void (^assetEnumerator)(struct ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop){
if(result != NULL) {
NSLog(@"See Asset: %@", result);
}
};
void (^assetGroupEnumerator)(struct ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) {
if(group != nil) {NSLog(@"dont See Asset: ");
[group enumerateAssetsUsingBlock:assetEnumerator];
}
};
[library enumerateGroupsWithTypes:ALAssetsGroupAlbum
usingBlock:assetGroupEnumerator
failureBlock: ^(NSError *error) {
NSLog(@"Failure");
}];

OK, newbie at blocks… but I found another example of an asset group enumerator block on here, and it didn’t have
structin the declaration. I tried removing it from the code above, and it still works fine and doesn’t have the error message. Hopefully someone who understandsstructbetter can explain?try changing this line:
to this:
I think the bottom line is that the
ALAssetsLibrary enumerateGroupsWithTypes: usingBlock:expects a block looking like(ALAssetsGroup *, BOOL *)not(struct ALAssetsGroup *, BOOL *).