NSPredicate从PHFetchResults中排除慢动作视频 [英] NSPredicate to exclude slow motion videos from PHFetchResults

查看:468
本文介绍了NSPredicate从PHFetchResults中排除慢动作视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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];

这是我的代码,用于提取不包含慢动作视频的视频.但是我遇到了以下错误.即使我这样也无法使用

This is my code to fetch videos which excludes slow motion videos. But I'm getting following error.This doesn't work even if I do like this,

PHFetchOptions *fetchOptions = [PHFetchOptions new];
fetchOptions.predicate = [NSPredicate predicateWithFormat:@"(mediaSubtype & %d) == 0", PHAssetMediaSubtypeVideoHighFrameRate];

请有人帮忙.预先感谢.

Somebody please help. Thanks in advance.

Unsupported predicate in fetch options: mediaSubtype == 131072

推荐答案

尝试一下:

fetchOptions.predicate = [NSPredicate predicateWithFormat:@"(mediaSubtype != %d)", PHAssetMediaSubtypeVideoHighFrameRate];

这篇关于NSPredicate从PHFetchResults中排除慢动作视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆