[英]Swift - create Live Photo from mov and jpg file
I would like to create a live photo from mov and jpg files.我想从 mov 和 jpg 文件创建实时照片。 I found the LivePhoto library https://github.com/LimitPoint/LivePhoto
我找到了 LivePhoto 库https://github.com/LimitPoint/LivePhoto
When I call generate function, I get an error - " Missing argument for parameter 'completion' in call".当我调用 generate function 时,我收到一个错误 - “调用中参数'完成'的参数丢失”。
@IBAction func saveLivePhoto(imageUrl: URL, videoUrl: URL){
LivePhoto.generate(from: imageUrl, videoURL: videoUrl, progress: { percent in }, completion: { livePhoto, resources in
LivePhoto.saveToLibrary(resources!)
})
}
What should I do to solve this problem?我应该怎么做才能解决这个问题?
You have missed to add completion block parameter in LivePhoto.saveToLibrary function call.您错过了在 LivePhoto.saveToLibrary function 调用中添加完成块参数。 Try the code below.
试试下面的代码。
@IBAction func saveLivePhoto(imageUrl: URL, videoUrl: URL){
LivePhoto.generate(from: imageUrl, videoURL: videoUrl, progress: { percent in }, completion: { livePhoto, resources in
LivePhoto.saveToLibrary(resources!) { (bool) in
}
})
}
Hope it helps.希望能帮助到你。 Cheers.
干杯。
LivePhoto.generate(from: YourimageUrl, videoURL: YourvideoUrl, progress: { percent in }, completion: { livePhoto, resources in LivePhoto.generate(from: YourimageUrl, videoURL: YourvideoUrl, progress: { percent in }, completion: { livePhoto, resources in
LivePhoto.saveToLibrary(resources!) { (bool) in
}
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.