I can't find a similar method to ALAssetsLibrary->writeImageDataToSavedPhotosAlbum in the new PHPhotoLibrary since ALAssetsLibrary deprecated in iOS 9 I can't save GIF probably I'm using this code
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetChangeRequest *assetRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:[UIImage imageWithData:gifdata]];
placeholder = [assetRequest placeholderForCreatedAsset];
photosAsset = [PHAsset fetchAssetsInAssetCollection:collection options:nil];
PHAssetCollectionChangeRequest *albumChangeRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:collection
assets:photosAsset];
[albumChangeRequest addAssets:@[placeholder]];
} completionHandler:^(BOOL success, NSError *error) {
if (success)
{
}
else
{
NSLog(@"%@", error);
}
}];
I've save gif file successfully to Photos Gallery by using Photos Framework
Hope this help!
I used
NSData
to save the gif image,ALAssetsLibrary
methodUIImageWriteToSavedPhotosAlbum
deprecated after iOS8,The api says we can usePHAssetCreationRequest
method[[PHAssetCreationRequest creationRequestForAsset] addResourceWithType:PHAssetResourceTypePhoto data:data options:options];
to save this gif image data, so you can use url request to save gifs as wellcodes are follows:
I solved my issue by creating temp file and using :