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

1

6

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?

Chee answered 22/6, 2010 at 12:46 Comment(4)
I tried this source again today. then no problem on this code. I don't know why, but anyway forget about this.Chee
in my case I getting error error: 'kUTTypeMovie' undeclared (first use in this function) . . .any ideaCymene
@Amit Battan: you need to import <MobileCoreServices/UTCoreTypes.h> and add the MobileCoreServices framework to your projectBlasphemous
@Blasphemous it is Ok .. please check my issue stackoverflow.com/questions/5514235Cymene
B
3

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

Boole answered 11/5, 2011 at 23:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.