简体   繁体   中英

Swift - create Live Photo from mov and jpg file

I would like to create a live photo from mov and jpg files. I found the LivePhoto library https://github.com/LimitPoint/LivePhoto

When I call generate function, I get an error - " Missing argument for parameter 'completion' in call".

@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. 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.saveToLibrary(resources!) { (bool) in

        }
    })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM