Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS4 UIImagePickerController doesn't suport mediaTypes = [NSArray arrayWithObject:(NSString *) kUTTypeMovie]?

In my application,I want to open the camera in Video mode.So 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, on iOS4 does not work. Can I use UIImagePickerController as a Video on iOS4?

like image 948
SUKIYAKI Avatar asked Jun 22 '10 12:06

SUKIYAKI


1 Answers

I'm new on iphone develop but i had the same problem and I solved that problem setting the mediaTypes like this

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

This allow you to have acces to the video and photo, i hope this help you

like image 115
Damian Rojas Avatar answered Sep 29 '22 10:09

Damian Rojas