我在编译时在目标c中遇到上述错误。我不知道为什么要得到这个。
下面是编码文件
Test.m 文件
- (void)displayDocumentPicker:(NSArray *)UTIs withSenderRect:(CGRect)senderFrame
{
UIViewController * vc = nil;
[importMenu addOptionWithTitle:@"Photos & Videos" image:nil order:UIDocumentMenuOrderFirst handler:^{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
imagePickerController.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:imagePickerController.sourceType];
imagePickerController.allowsEditing = NO;
imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
imagePickerController.delegate = self;
[self.viewController presentViewController:imagePickerController animated:YES completion:nil];
}];
if (!IsAtLeastiOSVersion(@"11.0")) {
vc = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:UTIs inMode:UIDocumentPickerModeImport];
((UIDocumentMenuViewController *)vc).delegate = self;
vc.popoverPresentationController.sourceView = self.viewController.view;
if (!CGRectEqualToRect(senderFrame, CGRectZero)) {
vc.popoverPresentationController.sourceRect = senderFrame;
}
} else {
vc = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:UTIs inMode:UIDocumentPickerModeImport];
((UIDocumentPickerViewController *)vc).delegate = self;
vc.modalPresentationStyle = UIModalPresentationFullScreen;
}
[self.viewController presentViewController:vc animated:YES completion:nil];
}
Test.h 文件
#import <Foundation/Foundation.h>
#import <Cordova/CDVPlugin.h>
#import <AssetsLibrary/AssetsLibrary.h>
@interface FilePicker : CDVPlugin <UIDocumentMenuDelegate,UIDocumentPickerDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@property (strong, nonatomic) CDVPluginResult * pluginResult;
@property (strong, nonatomic) CDVInvokedUrlCommand * command;
- (void)isAvailable:(CDVInvokedUrlCommand*)command;
- (void)pickFile:(CDVInvokedUrlCommand*)command;
@end
我需要在Test.h文件中添加任何标题吗?
答案 0 :(得分:0)
Afaik,您从未定义importMenu。
如何添加类似UIDocumentMenuViewController * importMenu = UIDocumentMenuViewController();
的东西,或者添加不推荐使用的类UIDocumentPickerViewController
呢?