Ashish Agarwal Ashish Agarwal - 7 days ago 5x
iOS Question

Use of undeclared identifier 'kUTTypeMovie'

I am getting the error message - Use of undeclared identifier 'kUTTypeMovie'

in the below code -

-(IBAction)selectVideo:(id)sender {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];

imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];

What's wrong with it ?



You have to add the framework MobileCoreServices to the project, and then import it:

#import <MobileCoreServices/MobileCoreServices.h>

That will make the problem go away.