使用未声明的标识符'kUTTypeMovie'

我收到错误信息 – 使用未声明的标识符'kUTTypeMovie'

在下面的代码中 –

-(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]; } 

它出什么问题了 ?

谢谢

您必须将框架MobileCoreServices添加到项目中,然后导入它:

 #import <MobileCoreServices/MobileCoreServices.h> 

这将使问题消失。

我在iOS开发和Xcode的新手,花了一些时间试图找出为什么只是导入不工作。 在与我的团队中更有经验的成员一起解决问题后,我发现不仅要包含这个问题

 #import <MobileCoreServices/MobileCoreServices.h> 

但是您还必须将二进制文件链接到MobileCoreServices框架的库到项目的构build阶段。

希望这可以帮助! 我确实需要这个信息,当我这样做。

迅速

 import MobileCoreServices 

目标c

 #import <MobileCoreServices/MobileCoreServices.h>