I know how to extract video from a live photo. Explained here.
Use the PHAssetResourceManager
to get the video file from the PHAssetResource
.
PHAssetResourceManager.defaultManager().writeDataForAssetResource(assetRes,
toFile: fileURL, options: nil, completionHandler:
{
// Video file has been written to path specified via fileURL
}
But how to extract image URL from PHLivePhoto. The motivation behind this is to get both video and image URL in order to upload it to the server.
Well assuming you have access to the PHAsset you can do something like the following:
[asset requestContentEditingInputWithOptions:nil
completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {
NSURL *imageURL = contentEditingInput.fullSizeImageURL;
}];
来源:https://stackoverflow.com/questions/39370406/how-to-extract-image-from-a-live-photo