Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 为什么PHAsset FETCHASSETSWITOPTIONS不';你不能归还所有资产吗?_Ios_Photosframework - Fatal编程技术网

Ios 为什么PHAsset FETCHASSETSWITOPTIONS不';你不能归还所有资产吗?

Ios 为什么PHAsset FETCHASSETSWITOPTIONS不';你不能归还所有资产吗?,ios,photosframework,Ios,Photosframework,我的照片流中有75张照片,相机卷中有1张照片(不在我的照片流中)。我总共有76张照片。但以下代码仅返回51张照片: PHFetchOptions *options = [[PHFetchOptions alloc] init]; options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]]; assetsFetchResults = [

我的照片流中有75张照片,相机卷中有1张照片(不在我的照片流中)。我总共有76张照片。但以下代码仅返回51张照片:

    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不,我不想要瞬间。