Ios 使用AlasSetPropertyAsetUrl获取ALAsset的UID URL
我通过调用[asset valueForProperty:AlassetPropertyAsetUrl]获取资产URL,有时它返回nil或者可能是asset为nil(我在崩溃日志中看到过)。 我在文档中读到: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
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属性,但它在我运行它的任何时候都可以工作
问题:
我不明白这一点:“如果只有ALAssetRepresentation和AlassetGroup类支持此属性,如何获取URL?”我们可以将类似的内容用于
ALAsset
对象
[[asset defaultRepresentation] url]
很抱歉,此方法将在将来的ios中被弃用。是。我们必须使用PhotosLibrary而不是AssetLibrary。您必须使用PHAsset。