如何保存实时照片?

时间:2018-04-19 06:38:18

标签: swift phlivephoto

PHPhotoLibrary.shared().performChanges({ () -> Void in

let request = PHAssetCreationRequest.forAsset()
request.addResource(with: .pairedVideo, fileURL: videoURL, options: nil)

request.addResource(with: .photo, fileURL: imageURL, options: nil)}, completionHandler: { (result : Bool, error : Error?) -> Void in
    if result {
        NSLog("save to camera roll as live photo")
    } else {
        if error != nil {
            print("something wrong when saving : %@", error!)
        }
    }
})
  

但是,错误域= NSCocoaErrorDomain代码= -1"(null)"。如何解决?

1 个答案:

答案 0 :(得分:-1)

已修复.Jpg和mov必须添加元数据。

1.jpg,必须添加元数据: 17:UUID()。uuidString

2.mov,必须添加元数据: com.apple.quicktime.content.identifier:UUID()。uuidString