输出结果显示:
- 快照未呈现的视图会导致空快照。确保在屏幕更新后快照或快照之前,您的视图至少呈现过一次 - 保存成功
但是当我进入解析后端时,没有任何东西被保存。
@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
})
}
答案 0 :(得分:0)
我明白了。我在数据库中有一个额外的列,在应用程序代码中没有列出。当我删除它时,数据已成功发送。