Ios Appcelerator模块事件停止触发
我有一个本机iOS模块,需要定期触发事件。这些活动非常有效。。。有时候。随机的,他们就是不开火 在Obj-C中,该按钮使用TiBlob映像在NSNotificationCenter defaultCenter上触发事件。我的模块类侦听此通知,并调用以下函数:Ios Appcelerator模块事件停止触发,ios,objective-c,module,appcelerator,appcelerator-titanium,Ios,Objective C,Module,Appcelerator,Appcelerator Titanium,我有一个本机iOS模块,需要定期触发事件。这些活动非常有效。。。有时候。随机的,他们就是不开火 在Obj-C中,该按钮使用TiBlob映像在NSNotificationCenter defaultCenter上触发事件。我的模块类侦听此通知,并调用以下函数: - (void) imageCaptured:(NSNotification *) notification { NSLog(@"[INFO] module notified of image capture event");
- (void) imageCaptured:(NSNotification *) notification
{
NSLog(@"[INFO] module notified of image capture event");
if ([self _hasListeners:IMAGECAPTUREDEVENT])
[self fireEvent:IMAGECAPTUREDEVENT withObject:notification.userInfo];
else
NSLog(@"[INFO] if an image is captured, and there is no one there to listen for it, does an event get fired?");
}
在JS中,我有一个eventlistener,如下所示:
mymodule.addEventListener('imageCaptured', function(e){
Ti.API.info('image capture event caught in JS.);
});
这在某些时候确实有效。如果我将Ti.blob对象添加到侦听器中,我甚至可以看到返回的Ti.blob对象,但其他时候。。。我看到“[INFO]模块收到图像捕获事件通知”日志,然后什么都没有。没有错误。没有关于没有听众的妙语。而且没有“在JS中捕获图像捕获事件”。看起来您发现了一个bug。谢谢你!你能检查一下这是否是目前已知的问题吗。如果不是,请创建一张记录单,链接到这个问题,同时在记录单中提供可复制的代码、步骤和环境信息。别忘了在此处放置一个到票证的链接,以便其他人可以与您一起观看。同时,我已使用[[self proxy]fireEvent将我的事件移动到视图本身……这似乎每次都能正常工作。很高兴听到您找到了解决方法。您能将其作为注释添加到票证中吗?我添加了注释。感谢您的帮助。。