我正在尝试保存位于已使用 Regift 代码创建的临时文件中的 GIF 图像。
Regift: https://github.com/matthewpalmer/Regift https://github.com/matthewpalmer/Regift
问题是,用 PHPhotoLibrary 保存后,GIF 就变成了静态图像。
在其他问题中,有一些答案引用了 AssetsLibrary,但这已被 Apple 弃用,并且不适用于 iOS 10。
问题:
将 GIF 图像从 URL 保存到相机胶卷 https://stackoverflow.com/questions/32186219/save-gif-image-from-url-to-camera-roll
如何将动画 GIF 写入 iOS 相机胶卷? https://stackoverflow.com/questions/17499513/how-to-write-animated-gif-to-ios-camera-roll
这些答案都不起作用...我只想将图像转换为 gif 并将其保存到相机胶卷...有什么帮助吗?
Thanks
您可以通过 PHPhotoLibrary 保存 GIF。
PHPhotoLibrary.shared().performChanges({
let request = PHAssetCreationRequest.forAsset()
request.addResource(with: .photo, fileURL: 'YOUR_GIF_URL', options: nil)
}) { (success, error) in
if let error = error {
print(error.localizedDescription)
} else {
print("GIF has saved")
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)