https://blog.csdn.net/u012681458/article/details/52883163 例子
iOS 8以后
/**
保存到相册
@param path 路径
*/
+(BOOL)savedToPhotosAlbum:(NSString *)path{
__block NSString *createdAssetID =nil;//唯一标识,可以用于图片资源获取
NSError *error =nil;
[[PHPhotoLibrary sharedPhotoLibrary] performChangesAndWait:^{
createdAssetID = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:[NSURL fileURLWithPath:path]].placeholderForCreatedAsset.localIdentifier;
} error:&error];
return createdAssetID && !error;
}
iOS 8以前 如何把 GIF 动图保存到相册?
iOS 的相册是支持保存 GIF 和 APNG 动图的,只是不能直接播放。用 [ALAssetsLibrary writeImageDataToSavedPhotosAlbum:metadata:completionBlock] 可以直接把 APNG、GIF 的数据写入相册。如果图省事直接用 UIImageWriteToSavedPhotosAlbum() 写相册,那么图像会被强制转码为 PNG。