在调用Ti.App.iOS.endBackgroundHandler(e.handlerId)之前打开应用程序时出现黑屏;

时间:2014-09-24 07:09:36

标签: ios objective-c titanium

我有一个简单的iOS测试应用程序,可以响应静音推送通知。

var window = Ti.UI.createWindow({

});
var view = Titanium.UI.createView({
   borderRadius:10,
   backgroundColor:'red',
   width:50,
   height:50
});
Ti.App.iOS.addEventListener("silentpush", function (e) {
    if (e && typeof e !== 'undefined' && e.aps && e.aps['content-available'] && typeof     e.aps['content-available'] !== 'undefined') {
        Ti.API.info('silent push received in app.js');
    }
});

window.add(view);
window.open();

如果收到静音推送并打开应用程序,我会看到黑屏。如果我再次按下主页按钮并重新打开应用程序,则黑屏会消失。

此外,如果我在事件监听器内调用Ti.App.iOS.endBackgroundHandler(e.handlerId);,则不会出现黑屏。但我想只有在处理完成时才应调用Ti.App.iOS.endBackgroundHandler(e.handlerId);

一般情况下,如果应用程序在Apple提供的30秒窗口之前打开,用于后台下载或调用Ti.App.iOS.endBackgroundHandler(e.handlerId);之前,我会看到黑屏。

请提前帮助,谢谢。

0 个答案:

没有答案