Failed to perform operation using UIImagePickerControler

I use UIImagePickerController in part of my application, which allows the user to select a video from a camera roll. The problem I am facing is that when I select certain videos from the image view controller at runtime, I get a dialog box that says “Operation could not be completed” and the application freezes.

The error and freezing occur as soon as you click on the video that you want from the camera’s clip, and before you click the “Select” button - therefore, when an error didFinishPickingMediaWithInfo() is not already running.

Error triggering videos are not damaged files, as I can perfectly observe them using my Camera Camera application directly.

Here is the code that I have in my project to set up a UIImagePickerViewController:

 videoViewController = UIImagePickerController() videoViewController.delegate = self videoViewController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary videoViewController.mediaTypes = [kUTTypeMovie as String] videoViewController.allowsEditing = false videoViewController.modalPresentationStyle = .CurrentContext 

The two files that trigger this error have one thing in common - they were both emailed to me from another phone. But if they are not corrupt, what could happen?

+7
ios swift uiimagepickercontroller
source share
1 answer

The answer to the question is that the video files causing the error are of type .3gp .

It turns out that knowing this fact is useless if I still want to use the UIPickerImageController so that the user can select a video. There is no way to control what types of video files are displayed in the UIPickerImageController , and there is no way to add Apple code to convert .3gp videos to another format between the time a user clicks on it in the UIPickerImageController and the time the crash occurs.

+7
source share

All Articles