Ios 为什么PHAsset FETCHASSETSWITOPTIONS不';你不能归还所有资产吗?
我的照片流中有75张照片,相机卷中有1张照片(不在我的照片流中)。我总共有76张照片。但以下代码仅返回51张照片:Ios 为什么PHAsset FETCHASSETSWITOPTIONS不';你不能归还所有资产吗?,ios,photosframework,Ios,Photosframework,我的照片流中有75张照片,相机卷中有1张照片(不在我的照片流中)。我总共有76张照片。但以下代码仅返回51张照片: PHFetchOptions *options = [[PHFetchOptions alloc] init]; options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]]; assetsFetchResults = [
PHFetchOptions *options = [[PHFetchOptions alloc] init];
options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]];
assetsFetchResults = [PHAsset fetchAssetsWithOptions:options];
我知道:
如果iOS 8.1上或之后链接的应用程序调用此方法,则
结果不包括从iTunes同步到设备的照片
或存储在iCloud共享照片流中的照片
但上面的照片都不是来自iCloud共享照片流。不是最漂亮的,但请尝试以下方法以获取所有资源:
NSMutableArray *_assets = [NSMutableArray new];
PHFetchResult *fr = [PHAssetCollection fetchMomentsWithOptions:nil];
for (PHAssetCollection *collection in fr) {
PHFetchResult *_fr = [PHAsset fetchAssetsInAssetCollection:collection options:nil];
for (PHAsset *asset in _fr) {
[_assets addObject:asset];
}
}
试试这个-[Phaset FetchAssets WithMediaType:Phaset MediaType图像选项:选项];你试过瞬间收藏吗?@UttamSinha不,我不想要瞬间。