Swift - 从 mov 和 jpg 文件创建实时照片
Swift - create Live Photo from mov and jpg file
我想从 mov 和 jpg 文件创建实时照片。我找到了 LivePhoto 图库 https://github.com/LimitPoint/LivePhoto
当我调用 generate 函数时,出现错误 - “调用中缺少参数 'completion' 的参数”。
@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 函数调用中添加完成块参数。试试下面的代码。
@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
}
})
}
希望对您有所帮助。干杯。
我想从 mov 和 jpg 文件创建实时照片。我找到了 LivePhoto 图库 https://github.com/LimitPoint/LivePhoto
当我调用 generate 函数时,出现错误 - “调用中缺少参数 'completion' 的参数”。
@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 函数调用中添加完成块参数。试试下面的代码。
@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
}
})
}
希望对您有所帮助。干杯。