NSString *predicateFormat = [NSString stringWithFormat: @"mediaSubtype = %zd", PHAssetMediaSubtypeVideoHighFrameRate];
NSPredicate *predicate = [NSPredicate predicateWithFormat: predicateFormat];
PHFetchOptions *fetchOptions = [PHFetchOptions new];
fetchOptions.predicate = predicate;
PHFetchResult *userAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeSmartAlbumVideos options:fetchOptions];
这是我提取视频的代码,不包括慢动作视频。但我得到了以下错误。即使我这样做,这也行不通,
PHFetchOptions *fetchOptions = [PHFetchOptions new];
fetchOptions.predicate = [NSPredicate predicateWithFormat:@"(mediaSubtype & %d) == 0", PHAssetMediaSubtypeVideoHighFrameRate];
有人请帮忙。提前谢谢。
Unsupported predicate in fetch options: mediaSubtype == 131072
答案 0 :(得分:2)
要排除慢动作视频,唯一对我有用的谓词是:
PHFetchOptions *options = [PHFetchOptions new];
// Disable slow motion videos
options.predicate = [NSPredicate predicateWithFormat:@"NOT ((mediaSubtype & %d) != 0)", PHAssetMediaSubtypeVideoHighFrameRate];
答案 1 :(得分:2)
Swift 4
let assetFetchOptions = PHFetchOptions()
assetFetchOptions.predicate = NSPredicate(format: "NOT ((mediaSubtype & %d) != 0)", PHAssetMediaSubtype.videoHighFrameRate.rawValue)
答案 2 :(得分:1)
试试这个:
fetchOptions.predicate = [NSPredicate predicateWithFormat:@"(mediaSubtype != %d)", PHAssetMediaSubtypeVideoHighFrameRate];