简体   繁体   中英

Titanium IOS app - unrecognized selector sent to instance

I have an app for Android and IOS. On Android it works ok, but on IOS, I have this error:

[ERROR] :  Script Error {
[ERROR] :      backtrace = "#0 () at :0";
[ERROR] :      line = 197;
[ERROR] :      message = "-[TiUIViewProxy fireEvent:withObject:remove:thisObject:]: unrecognized selector sent to instance 0xeb07400";
[ERROR] :      sourceId = 303988736;
[ERROR] :      sourceURL = "file:///Users/Almudena/Library/Application%20Support/iPhone%20Simulator/7.0/Applications/380C4F68-33F0-4198-BAB4-B53FC5280609/APPNAME.app/views/interconexiones/InterconexionesSaldoGrafico2.js";
[ERROR] :  }

It's very strange because, I have views, and InterconexionesSaldoGrafico2 is a module that return a view.

The first time I load InterconexionesSaldoGrafico2 works ok, but the second one, I have the previous error.

In this module I load a web view, and the error point at :

var loadWebView = function(e) {
    Ti.App.fireEvent('InitWebviewHTML5Step', {
        values : dataInterconexionesJson,
        dp : utils.getFactorTodp() //HERE
    });
};

I call this method:

webviewHTML5StepPortrait.addEventListener('load', loadWebView);

Do you know what could be the error?

Thank you very much

UPDATE

Sometimes exception happens and sometimes the app is closed without saying anything.

I don't know what

utils.getFactorTodp

does, but if you want to pass the function and not evaluate it, you must remove the parenthesis. So if dp is called later by the eventListener, replace utils.getFactorTodp() by utils.getFactorTodp

That way, you will reference to the function instead of trying to evaluate it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM