ALAsset
An ALAsset object represent a photo or a video managed by the Photo application.
Assets can have multiple representations, for example a photo which was captured in RAW and JPG. Different representations of the same asset may have different dimensions.
ALAssetsGroup
An ALAssetsGroup
object represents an ordered set of the assets managed by the Photos application. The order of the elements is the same as the user sees in the Photos application. An asset can belong to multiple assets groups.
Assets groups themselves are synced via iTunes, created to hold the user’s saved photos or created during camera import. You can indirectly modify the Saved Photos group by saving images or videos into it using the ALAssetsLibrary
class.
ALAssetsLibrary
An instance of ALAssetsLibrary
provides access to the videos and photos that are under the control of the Photos application.
The library includes those that are in the Saved Photos album, those coming from iTunes, and those that were directly imported into the device. You use it to retrieve the list of all asset groups and to save images and videos into the Saved Photos album.
The lifetimes of objects you get back from a library instance are tied to the lifetime of the library instance.(从library中得到的对象的生命周期和library的生命周期绑定)
Many of the methods declared by ALAssetsLibrary
take blocks for failure and success as arguments. These methods are all asynchronous because the user may need to be asked to grant access to the data.