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

标签 ios cocoa-touch mobilecoreservices

我收到错误消息 - 使用未声明的标识符“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 添加到项目中,然后将其导入:

objective-c :

#import <MobileCoreServices/MobileCoreServices.h>

这将使问题消失。

swift 4:

import MobileCoreServices

关于ios - 使用未声明的标识符 'kUTTypeMovie',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11755494/

相关文章:

ios - 在 UIView 外部添加边框(而不是在内部)

ios - 使用 Swift 从 iOS 中的 PhotoLibrary 选择视频

iOS 标签栏图标越来越大

ios - 在 iOS 6.1 上,UISwitch IBOutlet 始终为 nil

ios - 找不到符号 : kUTTypeImage

ios - 为什么 weak for property 和 __weak for instance variable 表现不同

ios - 推送后立即弹出 View Controller

ios - CIImage(IOS): Adding 3x3 convolution after a monochrome filter somehow restores color

ios - 无法在 Xcode 10 上存档