【问题标题】:Saving an animated gif from AppData to photo album - iOS 11将动画 gif 从 AppData 保存到相册 - iOS 11
【发布时间】:2018-01-23 00:39:51
【问题描述】:

如何将 gif 从 Documents 或 AppData 文件夹(或其他已知路径)保存到 iOS 11 相册​​?

已知路径示例:/var/mobile/Containers/Data/Application/[app uuid]/Documents/filename.gif

Older versions 这个question 继续引用已弃用的ALA*。你如何为 iOS 11 做到这一点?

【问题讨论】:

标签: ios gif ios11


【解决方案1】:

添加框架基础和照片

#import #import int saveGifToGallery(const char *path0){ NSString *path = [NSString stringWithUTF8String:path0]; NSData *data = [NSData dataWithContentsOfFile:path]; [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ PHAssetResourceCreationOptions *options = [[PHAssetResourceCreationOptions alloc] init]; [[PHAssetCreationRequest creationRequestForAsset] addResourceWithType:PHAssetResourceTypePhoto data:data options:options]; } completionHandler:^(BOOL 成功,NSError * _Nullable 错误) { NSLog(@":%d",成功); }]; 返回 1; }

【讨论】:

    猜你喜欢
    • 2014-02-05
    • 2016-03-28
    • 1970-01-01
    • 2018-11-12
    • 1970-01-01
    • 2018-01-26
    • 2021-06-24
    • 2017-12-11
    • 1970-01-01
    相关资源
    最近更新 更多