I’m trying to access photos in the iOS asset library that the user has taken using Burst Mode. I’m trying using ALAssetsLibrary
and filtering photos:
- (void)findBurstModePhotos
{
ALAssetsFilter *allPhotos = [ALAssetsFilter allPhotos];
ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init];
[assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll
usingBlock:^(ALAssetsGroup *group,
BOOL *stop) {
[group setAssetsFilter:allPhotos];
NSLog(@"Group: %@",
[group valueForProperty:
ALAssetsGroupPropertyName]);
if ([group numberOfAssets] > 0) {
[self evaluateGroup:group];
}
}
failureBlock:^(NSError *error) {
NSLog(@"Failure enumerating groups: %@",
[error localizedDescription]);
}];
}
- (void)evaluateGroup:(ALAssetsGroup *)group
{
[group enumerateAssetsUsingBlock:^(ALAsset *result,
NSUInteger index,
BOOL *stop) {
NSLog(@"Photo date: %@", [result valueForProperty:ALAssetPropertyDate]);
}];
}
Unfortunately, this returns Burst Mode photos as a single photo. Is there a supported way to get Burst Mode photos individually? I’d like to get each photo from a single Burst Mode session.
From my understandings, the Burst Mode photos will be added to the library as one by one.The
ALAssetProperty
type of each image will beALAssetTypePhoto
.So you can get each photo separately using the below ALAsset block. You can't retrieve only the set of Burst Mode photos at a time because there are only 7 types ofALAssetsGroupTypes
and 3 kinds ofALAssetsFilters
are available. None of them are dealing with Burst Mode photos.I hope Apple will provide Burst photo filtering in the future.
Use the below code to get each photo separately including the Burst Mode photos,
Output Log:
Note:
If the Burst Mode photo capture camera is a part of your application,then store the
ALAsset URL's
when saving the captured photos to the photo gallery.You can retrieve this photo back using the savedALAsset URL's
viaALAsset
library.