当按下按钮呈现imagePickerController时,我调用了一个函数,但是当必须拍摄视频时,应用程序崩溃,即使我在设备上运行(iPad 2)。
@IBAction func beginTest() {
imagePicker = UIImagePickerController()
imagePicker.allowsEditing = false
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.mediaTypes = [kUTTypeVideo as String, kUTTypeImage as String]
if photoTests.contains(currentTestNum) {
imagePicker.cameraCaptureMode = .Photo
} else {
imagePicker.cameraCaptureMode = .Video //exception thrown here.
}
presentViewController(imagePicker, animated: true, completion: nil)
}