fireEvent in iOS module don't calls defined function

You must Login before you can answer or comment on any questions.

I try to fill a webview in titanium using stored data in a iOS module, but when I try to call "fireEvent" my function reference in app.js just don't get called and the app closes itself with "[INFO] Application has exited from Simulator".

In my iOS module I add a listener like this:

-(void)_listenerAdded:(NSString *)type count:(int)count
{
    if (count == 1 && [type isEqualToString:@"finishedCaching"])
    {
        NSLog(@"Event registered.");
        // the first (of potentially many) listener is being added 
        // for event named 'my_event'
    }
}
and call for it using this method:
-(void)loadCacheDataForUrl:(id)args {
    [self fireEvent:@"finishedCaching" withObject:nil];
    NSLog(@"Fired event with object"); //output in console works
}
my app.js looks like: (
var test = require('com.test');
 
//Event: Receiving data from module
function loadHTMLContents() {
    Ti.API.info("Creating web view"); //no output in console
    //var webview = Titanium.UI.createWebView(blob.data);
    //win.add(webview);
}
test.addEventListener("finishedCaching", loadHTMLContents);
 
test.loadCacheDataForUrl();

— asked 12 months ago by Stefan Trautvetter
1 Comment
  • Today I tried the same example on Android. I was curious about to find out if this problem apears on other platforms too. After some problems with the build script (yes, NDK is required - was never mentioned in the Android Module guide...) I finally set this up and voilĂ  - it works!

    So what went wrong with my iOS example?

    — commented 12 months ago by Stefan Trautvetter

Your Answer

Think you can help? Login to answer this question!