Video is not saving in parse

我的梦境 提交于 2020-02-08 05:31:05

问题


The output says:

- Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
- Save successful

But when I go into the parse backend nothing is saved.

@IBAction func recordAction(sender: AnyObject) {

    if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
    print("Camera Available")

    let imagePicker = UIImagePickerController()

        imagePicker.delegate = self
        imagePicker.sourceType = .Camera
        imagePicker.mediaTypes = [kUTTypeMovie as String]
        imagePicker.videoMaximumDuration = 180 // Perhaps reduce 180 to 120
        imagePicker.videoQuality = UIImagePickerControllerQualityType.TypeMedium
        imagePicker.allowsEditing = false

        imagePicker.showsCameraControls = true

        self.presentViewController(imagePicker, animated: true, completion: nil)
    }
        else {
            print("Camera Unavailable")
        }
}

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {

    let Video = PFObject(className:"Video")
    Video["user"] = PFUser.currentUser()

   let tempImage = info[UIImagePickerControllerMediaURL] as! NSURL!
   _ = tempImage.relativePath

    let videoData = NSData(contentsOfFile:tempImage.relativePath!)

    let videoFile:PFFile = PFFile(name:"consent.mp4", data:videoData!)!
    Video["videoFile"] = videoFile
    self.dismissViewControllerAnimated(true, completion: nil)
    videoFile.saveInBackgroundWithBlock({ (succeeded: Bool, error: NSError?) -> Void in
        // Handle success or failure here ...
        if succeeded {
            print("Save successful")
        } else {
            print("Save unsuccessful: \(error?.userInfo)")
        }

        }, progressBlock: { (amountDone: Int32) -> Void in

    })
}

回答1:


I figured it out. I had an extra column in the database that was unaccounted for in the apps code. When i removed it, the data was sent successfully.



来源:https://stackoverflow.com/questions/34552158/video-is-not-saving-in-parse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!