[英]Swift - create Live Photo from mov and jpg file
我想從 mov 和 jpg 文件創建實時照片。 我找到了 LivePhoto 庫https://github.com/LimitPoint/LivePhoto
當我調用 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!)
})
}
我應該怎么做才能解決這個問題?
您錯過了在 LivePhoto.saveToLibrary function 調用中添加完成塊參數。 試試下面的代碼。
@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
}
})
}
希望能幫助到你。 干杯。
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.