Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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 使用AlasSetPropertyAsetUrl获取ALAsset的UID URL_Ios_Objective C_Alassetslibrary_Alasset - Fatal编程技术网

Ios 使用AlasSetPropertyAsetUrl获取ALAsset的UID URL

Ios 使用AlasSetPropertyAsetUrl获取ALAsset的UID URL,ios,objective-c,alassetslibrary,alasset,Ios,Objective C,Alassetslibrary,Alasset,我通过调用[asset valueForProperty:AlassetPropertyAsetUrl]获取资产URL,有时它返回nil或者可能是asset为nil(我在崩溃日志中看到过)。 我在文档中读到: ALAssetPropertyAssetURL The key to retrieve a URL identifier for the asset. The corresponding value is an NSURL object. This URL is used by the

我通过调用[asset valueForProperty:AlassetPropertyAsetUrl]获取资产URL,有时它返回nil或者可能是asset为nil(我在崩溃日志中看到过)。 我在文档中读到:

ALAssetPropertyAssetURL
The key to retrieve a URL identifier for the asset.

The corresponding value is an NSURL object.

This URL is used by the library-change notifications to identify assets and asset groups. Only the ALAssetRepresentation and ALAssetsGroup classes support this property.
我想这意味着,我无法从ALAsset获取AlassetPropertyAsetUrl属性,但它在我运行它的任何时候都可以工作

问题:

  • 如何获取资产url以在[PHAsset FetchAssets WithAlasSetUrls:…]中使用它
  • UPD


    我不明白这一点:“如果只有ALAssetRepresentation和AlassetGroup类支持此属性,如何获取URL?”

    我们可以将类似的内容用于
    ALAsset
    对象

    [[asset defaultRepresentation] url]
    

    很抱歉,此方法将在将来的ios中被弃用。是。我们必须使用PhotosLibrary而不是AssetLibrary。您必须使用PHAsset。