B.S. B.S. - 1 year ago 115
Objective-C Question

ALAssetsLibrary get Camera Roll

I enumerate all assets groups using


Here is code:

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

void (^enumerate)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop)
if (group == nil)
// enumerated all albums..

// I hot to check if group is Camera Roll ?


[library enumerateGroupsWithTypes:ALAssetsGroupAll

How to check if some current enumerated is CameraRoll?

Edit: As i tested it was always the last, using this enumerating. But i am not sure if it is the rule, are there any references that i missed?

Answer Source

To get photos from camera roll use ALAssetsGroupSavedPhotos while enumerating assets library:

[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos

To detect what group you currently get:

if ([[group valueForProperty:@"ALAssetsGroupPropertyType"] intValue] == ALAssetsGroupSavedPhotos)
    NSLog(@"Camera roll");