/* When a user edits an asset, Photos saves a PHAdjustmentData object along with the modified image or video data. 在用户编辑一个 asset 时,相册会存储该 asset 在修改 image 或者 video 数 据的过程中 */ PHAdjustmentData
什么是 asset?
PHAsset
1 2 3 4 5 6
/* A PHAsset object represents an image or video file that appears in the Photos app, including iCloud Photos content. 一个 PHAsset 对象代表相册中或者云存储中的一个 image 或者 video 文件。 */
PHAssetChangeRequest
PHAssetChangeRequest
1 2 3 4 5 6 7
/* You create and use PHAssetChangeRequest objects within a photo library change block to create, delete, or modify PHAsset objects. 当你在相册中增删改 PHAsset 对象时需要使用 PHAssetChangeRequest 对象 */
PHAssetCreationRequest
1 2 3 4 5 6 7 8 9
/* A PHAssetCreationRequest object, used within a photo library change block, constructs a new photo or video asset from data resources, and adds it to the Photos library. PHAssetCreationRequest 对象用于在照片库的增删改操作中,创建一个新的 image 和 video asset 从 data resources 中,然后将其加入 photos library 中。 */
PHAssetCollectionChangeRequest
1 2 3 4 5 6 7 8
/* You create and use PHAssetCollectionChangeRequest objects within a photo library change block to create, delete, or modify PHAssetCollection objects. 当你对 photo library 即 assetCollection 进行增删改操作时,使用 PHAssetCollectionChangeRequest 对象 */
PHAssetResourceCreationOptions
1 2 3 4 5 6 7 8
/* You use a PHAssetResourceCreationOptions object to specify options when creating a new asset from data resources with a PHAssetCreationRequest object. 通过 PHAssetResourceCreationOptions 对象来指定当创建一个 新的 asset 的 options。 */
PHAssetResourceManager
1 2 3 4 5 6 7 8
/* The shared PHAssetResourceManager object provides methods for accessing the underlying data storage for the resources associated with a Photos asset. PHAssetResourceManager 对象提供方法访问关联相机 asset 资源的基础数据存 储 */
PHAssetCollection
1 2 3 4 5 6
/* A PHAssetCollection object represents a collection of photo or video assets. 一个 PHAssetCollection 对象就代表一个相册 */
重点:
PHPhotoLibrary
1 2 3 4 5 6 7 8 9
/* The shared PHPhotoLibrary object represents the user’s Photos library—the entire set of assets and collections managed by the Photos app, including objects stored on the local device and (if enabled) in iCloud Photos. 公共的 PHPhotoLibrary 对象代表用户的相册库,所有的图片和相册管理都 要 PHPhotoLibrary 管理。 */
[PHAssetChangeRequest creationRequestForAssetFromImage:self.imageView.image]; /* 但是单独使用时,程序会报错。错误如下: 错误信息:This method can only be called from inside of - [PHPhotoLibrary performChanges:completionHandler:] or - [PHPhotoLibrary performChangesAndWait:error:] 错误信息说的很清楚,这个方法只能在 PHPhotoLibrary 类中的这两个方法中 使用。 在 iOS app 中,任何对 photos 的增删改操作,都一定会放在上述错误信息的 两个方法中。 */