1 decade ago by demonixis
Hi,
I'm developping an application with multiple views. My main view is a menu which is responsible to launch an Ejecta view with some parameters.
I launch an Ejecta view like that
Wanaplan2/3DViewController inherit from EJAppViewController. In the method viewDidLoad, I call a JavaScript function from objective-C and after that I add some GUI elements such as labels and buttons.
My problem is that when I click on my back button to close this view I have an NSInvalidArgumentException. This is the code that I use to close and dealloc the view:
The view is closing and when I'm back to my menu view (which is a simple UIViewController), the application crash with this message:
I'm a beginner with iOS development and my code is probably wrong. Can you help me to solve this problem ?
Thanks !
I'm developping an application with multiple views. My main view is a menu which is responsible to launch an Ejecta view with some parameters.
I launch an Ejecta view like that
- (IBAction)downloadButton:(id)sender { UIViewController *controller; if (modeSelector.isOn) controller = [[Wanaplan3DViewController alloc] initWithScriptAtPath:@"index.js"]; else controller = [[Wanaplan2DViewController alloc] initWithScriptAtPath:@"index.js"]; [self presentViewController:controller animated:YES completion:nil]; [controller release]; }
Wanaplan2/3DViewController inherit from EJAppViewController. In the method viewDidLoad, I call a JavaScript function from objective-C and after that I add some GUI elements such as labels and buttons.
- (void)viewDidLoad { [super viewDidLoad]; EJJavaScriptView *jsView = (EJJavaScriptView *)self.view; [jsView evaluateScript:@"run(0)"]; [jsView release]; // Add some buttons and labels }
My problem is that when I click on my back button to close this view I have an NSInvalidArgumentException. This is the code that I use to close and dealloc the view:
- (void)dealloc { [backButton removeFromSuperview]; [backButton removeTarget:self action:@selector(backButtonClick:) forControlEvents:UIControlEventTouchUpInside]; [backButton release]; [super dealloc]; } - (IBAction)backButtonClick:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; }
The view is closing and when I'm back to my menu view (which is a simple UIViewController), the application crash with this message:
2014-02-28 10:05:42.736 Wanaplan[3014:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString pointerValue]: unrecognized selector sent to instance 0xb90baf0'
I'm a beginner with iOS development and my code is probably wrong. Can you help me to solve this problem ?
Thanks !