IOS4 UIImagePickerController does not support mediaTypes = [NSArray arrayWithObject: (NSString *) kUTTypeMovie]?

In my application, I want to open the camera in video mode. Therefore, I write the following codes

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:viewController.view]; [window makeKeyAndVisible]; UIImagePickerController *ipc; ipc = [[UIImagePickerController alloc] init]; ipc.sourceType = UIImagePickerControllerSourceTypeCamera; ipc.mediaTypes = [NSArray arrayWithObject:(NSString *) kUTTypeMovie]; [viewController presentModalViewController:ipc animated:YES]; return YES; } 

This code is good for iPhone 3.1.3, but it doesn’t work on iOS4. Can I use UIImagePickerController as a video on iOS4?

+6
iphone xcode ios4
source share
1 answer

I am new to iphone development, but I had the same problem and I solved this problem by setting media types like this.

 NSArray* mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera] ipc.mediaTypes = mediaTypes; 

This will allow you to have access to videos and photos, I hope this helps you

+3
source share

All Articles