asset(for:resultBlock:failureBlock:)
Invokes a given block passing as a parameter an asset identified by a specified file URL.
Declaration
func asset(for assetURL: URL!, resultBlock: ALAssetsLibraryAssetForURLResultBlock!, failureBlock: ALAssetsLibraryAccessFailureBlock!)Parameters
- assetURL:
An asset URL previously retrieved from an Alasset object.
- resultBlock:
The block to invoke using the asset identified by
assetURL.For a description of the block, see Alassetslibraryassetforurlresultblock.
- failureBlock:
The block to invoke if the user denies access to the assets library.
For a description of the block, see Alassetslibraryaccessfailureblock.
Discussion
This method is asynchronous. When the asset is requested, the user may be asked to confirm the application’s access to the library; the method, though, returns immediately. You should perform whatever work you want with the asset in resultBlock.
If the user denies access to the application, or if no application is allowed to access the data, the failure block is called.