quick3 进入后台返回前台不触发消息

quick3 进入后台返回前台不触发消息

quick3中framework/cc/mvc/AppBase中注册前后台函数,跟踪注册成功
local eventDispatcher = cc.Director:getInstance():getEventDispatcher()
local customListenerBg = cc.EventListenerCustom:create(cc.EVENT_COME_TO_BACKGROUND,
handler(self, self.onEnterBackground))
eventDispatcher:addEventListenerWithFixedPriority(customListenerBg, 1)
local customListenerFg = cc.EventListenerCustom:create(cc.EVENT_COME_TO_FOREGROUND,
handler(self, self.onEnterForeground))
eventDispatcher:addEventListenerWithFixedPriority(customListenerFg, 1)

但是lua中注册的函数却没有被调用
function AppBase:onEnterBackground()
printInfo(“AppBase:onEnterBackground()…”)
self:dispatchEvent({name = AppBase.APP_ENTER_BACKGROUND_EVENT})
end

function AppBase:onEnterForeground()
printInfo(“AppBase:onEnterForeground()…”)
self:dispatchEvent({name = AppBase.APP_ENTER_FOREGROUND_EVENT})
end

有人说quick 2.2.4可以调用成功,但是我看了下是用的CCNotificationCenter来处理的~

好吧 已经解决了,不知道是不是quick升级到3版本未解决的小BUG
1.在C++端,dispatch一下customevent
auto dispatcher = Director::getInstance()->getEventDispatcher();
if (dispatcher) {
dispatcher->dispatchCustomEvent(“APP_ENTER_BACKGROUND_EVENT”);
}
2.在lua端,注册接受下
local eventDispatcher = cc.Director:getInstance():getEventDispatcher()
local customListenerBg = cc.EventListenerCustom:create(“APP_ENTER_BACKGROUND_EVENT”,
handler(self, self.onEnterBackground))
eventDispatcher:addEventListenerWithFixedPriority(customListenerBg, 1)

请问lz的问题是怎么解决的阿