我试图将cordova项目添加到我现有的ios项目中.我可以成功编译应用程序.但是当我运行它时,我得到了cordovaSettingForKey的这个例外.
– [__ NSDictionaryM cordovaSettingForKey:]:无法识别的选择器发送到实例0x147052a30
EXCEPTION THROW: – [__ NSDictionaryM cordovaSettingForKey:]:无法识别的选择器发送到实例0x147052a30
任何人都知道如何解决问题
这是头文件
#import <Cordova/CDVViewController.h> #import <Cordova/CDVCommandDelegateImpl.h> #import <Cordova/CDVCommandQueue.h> @interface MainViewController : CDVViewController @end @interface MainCommandDelegate : CDVCommandDelegateImpl @end @interface MainCommandQueue : CDVCommandQueue @end
这是.m文件
#import "MainViewController.h" @implementation MainViewController - (id)initWithNibName:(Nsstring*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Uncomment to override the CDVCommandDelegateImpl used // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self]; // Uncomment to override the CDVCommandQueue used // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self]; } return self; } - (id)init { self = [super init]; if (self) { // Uncomment to override the CDVCommandDelegateImpl used // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self]; // Uncomment to override the CDVCommandQueue used // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self]; } return self; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data,images,etc that aren't in use. } #pragma mark View lifecycle - (void)viewWillAppear:(BOOL)animated { // View defaults to full size. If you want to customize the view's size,or its subviews (e.g. webView),// you can do so here. [super viewWillAppear:animated]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (BOOL)shouldAutorotatetoInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return [super shouldAutorotatetoInterfaceOrientation:interfaceOrientation]; } /* Comment out the block below to over-ride */ /* - (UIWebView*) newCordovaViewWithFrame:(CGRect)bounds { return[super newCordovaViewWithFrame:bounds]; } */ @end @implementation MainCommandDelegate /* To override the methods,uncomment the line in the init function(s) in MainViewController.m */ #pragma mark CDVCommandDelegate implementation - (id)getCommandInstance:(Nsstring*)className { return [super getCommandInstance:className]; } - (Nsstring*)pathForResource:(Nsstring*)resourcepath { return [super pathForResource:resourcepath]; } @end @implementation MainCommandQueue /* To override,uncomment the line in the init function(s) in MainViewController.m */ - (BOOL)execute:(CDVInvokedUrlCommand*)command { return [super execute:command]; } @end
我就是这样称呼的
MainViewController * layer = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
谢谢
-emmy
解决方法
尝试将-ObjC添加到目标的“其他链接标志”中.注意:cordova文档称它是“-Obj-C”标志,不能解决问题.
https://cordova.apache.org/docs/en/latest/guide/platforms/ios/webview.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。