PHPhotoLibrary保存gif数据 [英] PHPhotoLibrary save a gif data

查看:608
本文介绍了PHPhotoLibrary保存gif数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在新的PHPhotoLibrary中,我找不到与ALAssetsLibrary-> writeImageDataToSavedPhotosAlbum类似的方法,因为iOS 9中已弃用ALAssetsLibrary,我可能无法保存GIF,也许我正在使用此代码

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 solved my issue by creating temp file and using :

creationRequestForAssetFromImageAtFileURL

creationRequestForAssetFromImageAtFileURL

这篇关于PHPhotoLibrary保存gif数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆