Ответ 1
По моему пониманию, фотографии серийного режима будут добавлены в библиотеку по отдельности. Тип ALAssetProperty
каждого изображения будет ALAssetTypePhoto
. Таким образом, вы можете получить каждую фотографию отдельно, используя нижний блок ALAsset. Вы не можете получить только набор фотографий серийного режима за раз, поскольку существует только 7 типов ALAssetsGroupTypes
и доступны 3 вида ALAssetsFilters
. Ни один из них не имеет дело с фотографиями в режиме серийной съемки.
Я надеюсь, что Apple предоставит фильтрацию фотографий Burst в будущем.
---------------------------- ALAssetsGroupType -------------------------------------------
ALAssetsGroupLibrary // The Library group that includes all assets.
ALAssetsGroupAlbum // All the albums synced from iTunes or created on the device.
ALAssetsGroupEvent // All the events synced from iTunes.
ALAssetsGroupFaces // All the faces albums synced from iTunes.
ALAssetsGroupSavedPhotos // The Saved Photos album.
ALAssetsGroupPhotoStream // The PhotoStream album.
ALAssetsGroupAll // The same as ORing together all the available group types,with the exception that ALAssetsGroupLibrary is not included.
-------------------------- ALAssetsFilter ------------------------------------------------
+ (ALAssetsFilter *)allPhotos; // Get all photos assets in the assets group.
+ (ALAssetsFilter *)allVideos; // Get all video assets in the assets group.
+ (ALAssetsFilter *)allAssets; // Get all assets in the group.
Используйте приведенный ниже код, чтобы получить каждую фотографию отдельно, включая фотографии серийного режима,
- (void)findBurstModePhotos
{
ALAssetsLibrary *assetLibrary = [ViewController defaultAssetsLibrary];
[assetLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop)
{
[group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
if(result)
{
[self evaluateGroup:group];
}
}];
} failureBlock:^(NSError *error) {
NSLog(@"Error loading images %@", error);
}];
}
- (void)evaluateGroup:(ALAssetsGroup *)group
{
[group enumerateAssetsUsingBlock:^(ALAsset *result,
NSUInteger index,
BOOL *stop) {
NSLog(@"Photo date: %@", [result valueForProperty:ALAssetPropertyDate]);
}];
}
+ (ALAssetsLibrary *)defaultAssetsLibrary
{
static dispatch_once_t pred = 0;
static ALAssetsLibrary *library = nil;
dispatch_once(&pred, ^{
library = [[ALAssetsLibrary alloc] init];
});
return library;
}
Выходной журнал:
Photo date: 2013-05-06 15:57:21 +0000 //non burst image.
Photo date: 2013-05-06 15:57:41 +0000 //non burst image.
Photo date: 2013-12-20 21:10:40 +0000 //burst image.
Photo date: 2013-12-20 21:10:41 +0000 //burst image.
Photo date: 2013-12-20 21:10:41 +0000 //burst image.
Photo date: 2013-12-20 21:10:41 +0000 //burst image.
Photo date: 2013-12-20 21:10:41 +0000 //burst image.
Photo date: 2013-12-20 21:10:42 +0000 //burst image.
Photo date: 2013-12-20 21:10:42 +0000 //burst image.
Photo date: 2013-12-20 21:10:42 +0000 //burst image.
Photo date: 2013-12-20 21:10:43 +0000 //burst image.
Photo date: 2013-12-20 21:10:43 +0000 //burst image.
Photo date: 2013-12-20 21:10:43 +0000 //burst image.
Photo date: 2013-12-20 21:10:44 +0000 //burst image.
Photo date: 2013-12-20 21:10:44 +0000 //burst image.
Photo date: 2013-12-20 21:10:44 +0000 //burst image.
Photo date: 2013-12-20 21:10:44 +0000 //burst image.
Photo date: 2013-12-20 21:10:45 +0000 //burst image.
Photo date: 2013-12-20 21:10:45 +0000 //burst image.
Photo date: 2013-12-20 21:10:45 +0000 //burst image.
Photo date: 2013-12-20 21:10:45 +0000 //burst image.
Photo date: 2013-12-20 21:10:46 +0000 //burst image.
Примечание:
Если камера фотосъемки Burst Mode является частью вашего приложения, сохраните ALAsset URL's
при сохранении захваченных фотографий в галерее фотографий. Вы можете восстановить эту фотографию с помощью сохраненной библиотеки ALAsset URL's
через ALAsset
.