我有一个Sencha Touch应用程序,在启动Windows 10周年更新之前没有问题。使用新的SDK,我构建商店包后不会触发我的应用程序的onDeviceReady事件。 但它在调试模式下完美运行。
我认为这与.NET Native Tool Chain有关。但经过3天的故障排除和大量的谷歌搜索后,我仍然迷失了方向。这是我已经尝试过的:
以下是我安装的插件列表。
com.phonegap.plugins.PushPlugin 2.5.0 "PushPlugin"
com.verso.cordova.clipboard 0.1.0 "Clipboard"
cordova-plugin-camera 2.3.0 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-contacts 2.2.0 "Contacts"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-device-orientation 1.0.4 "Device Orientation"
cordova-plugin-file 4.3.0 "File"
cordova-plugin-geolocation 2.4.0 "Geolocation"
cordova-plugin-inappbrowser 1.5.0 "InAppBrowser"
cordova-plugin-media 2.4.0 "Media"
cordova-plugin-network-information 1.3.0 "Network Information"
cordova-plugin-screen-orientation 1.4.2 "Screen Orientation"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.3.0 "Whitelist"
cordova-sms-plugin 0.1.11 "Cordova SMS Plugin"
cordova.plugins.navbar 1.0.0 "NavBar"
phonegap-plugin-push 1.9.0 "PushPlugin"
我怀疑身体onload事件是不是被解雇了。因此,我也在html体内的脚本标签内调用onLoad()
函数。没有运气。
index.html正文
<body onload="onLoad()">
<div id="appLoadingIndicator"></div>
<script type="text/javascript">
onLoad();
var apploading = document.getElementById('appLoadingIndicator');
apploading.style.lineHeight = document.body.clientHeight + 'px';
var img = document.createElement('img');
img.setAttribute('src', resourceURL + '/loading/logo-splash.png');
apploading.appendChild(img);
</script>
</body>
onLoad功能定义
function onLoad() {
console.log('xxxxxx addEventListener onDeviceReady');
document.addEventListener("deviceready", onDeviceReady, false);
document.addEventListener("resume", onDeviceResume, false);
}
有没有人遇到任何类似的问题?任何暗示都会非常有用。
答案 0 :(得分:0)
我发现onDeviceReady实际上是在发射,但仅在5秒以上。 Sencha Touch应用程序在onDeviceReady被触发之前加载,并且应用程序在启动期间访问device
对象,即undefined
。这导致应用程序崩溃。因此,在onDeviceReady处理程序中触发app启动就可以了。
onDeviceReady()
在app.js中启动() function onDeviceReady() {
if (Ext.os.is.Phone) {
myApp.app.launchPhone();
} else {
myApp.app.launchTablet();
}
...
}
launch: function() {
// left empty intentionally
}