gpt4 book ai didi

ios8 - ALAssetsGroupSavedPhotos 最近的,不是全部,iOS8下的视频

转载 作者:行者123 更新时间:2023-12-02 04:53:00 25 4
gpt4 key购买 nike

我们的应用程序允许用户从他们的相机胶卷加载视频。这是非常标准的东西:

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

// Enumeration over all groups with videos
ALAssetsLibraryGroupsEnumerationResultsBlock groupsEnumerationBlock = ^(ALAssetsGroup *group, BOOL *stop)
{
[group setAssetsFilter:[ALAssetsFilter allVideos]];
[group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop)
{
if (result) {
// do stuff here with each video
}
}];
};

[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock: groupsEnumerationBlock
failureBlock:^(NSError *error) {
log4Debug(@"No groups found or accessible for Camera Roll.");
}
];

问题当然出在 iOS8 上。该代码枚举了 iOS7 下的所有视频,但在 iOS8 下它枚举了所有最近的视频。超过 30 天的视频不可用。

的确,当你在 iOS8 下查看照片应用时,你甚至看不到相机胶卷,只有一张“最近添加”的相册。现在,还有一个包含所有视频的“视频”相册。在这里访问就可以了。

我们无法转换为 PhotoKit(今天)。我们很快就会这样做,但现在我们需要一个同时适用于 iOS7 和 iOS8 的解决方案。

最佳答案

你试过这个吗:

PHFetchOptions *allPhotosOptions = [PHFetchOptions new];
allPhotosOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]];

PHFetchResult *allPhotosResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeVideo options:allPhotosOptions];

当我在我的设备上测试它时,它返回了我在设备上的所有视频,而不仅仅是最近的视频。

关于ios8 - ALAssetsGroupSavedPhotos 最近的,不是全部,iOS8下的视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25921887/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com