Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

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

- (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 !

1 decade ago by stillen

Why are you using multiple views instead of placing everything in the impact game, just out of curiosity?

Are you using ARC? You don't need to alloc and dealloc with ARC. I don't remember if ejecta uses ARC.

1 decade ago by demonixis

Hi,

I'm not developping a game but i'm porting a WebGL application to iOS. I need to have many view and I need to use native GUI to call some functions in the app.

The port itself run well with Ejecta (We're using a modified version of BabylonJS to work with Ejecta) but all user interactions are difficults.

Ejecta don't use ARC so I don't ;) I've tried to integrate Ejecta in a scenario but because of it doesn't use ARC, it's impossible (too much errors about dealloc).

I've written an article (in French) about Ejecta and our progress, you can read it here (fr) or here (google translated).
Page 1 of 1
« first « previous next › last »