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();
Your Answer
Think you can help? Login to answer this question!