I have been writing a Sencha Touch 2 app all week using the desktop to test it out. I've just now tried to integrate it with PhoneGap and test it on both the iOS Simulator and a physical iOS device.
I can see that the ST2 app is firing the 'launch', and have confirmed that the app still works on the desktop... but the Ext.viewport.add(...) does not appear to be updating the screen (default blue/blinking dots loader is still displayed).
My index.html looks like this:
<!DOCTYPE HTML>
<html manifest="" lang="en-US">
<head>
<meta charset="UTF-8">
<title>Yoga Journal's FindYoga</title>
<link href="resources/css/app.css" type="text/css" rel="stylesheet" />
<style type="text/css">
/* trimmed css */
</style>
<script type="text/javascript" src="cordova-2.0.0.js"></script>
<script id="microloader" type="text/javascript" src="sdk/sencha-touch.js"></script>
<script id="microloader" type="text/javascript" src="all-classes.js"></script>
<script id="microloader" type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
</head>
<body>
<div id="appLoadingIndicator">
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
My app.js looks like this:
Ext.application({
name: 'YogaNow',
controllers: ['Main', 'C1','C2','C3'],
views: ['Main'],
stores: ['S1', 'S2', 'S3','S4'],
models: ['M1', 'M2', 'M3','M4'],
launch: function() {
console.log('launch');
Ext.Viewport.add({
xtype: 'mainpanel',
});
},
});
if(Ext.os.deviceType == 'Desktop') {
setTimeout(function() {
var e = document.createEvent('Events');
e.initEvent('deviceready');
document.dispatchEvent(e);
}, 250);
}
As stated, the app runs fine (without errors) on the Desktop. If I remove the cordova reference from index.html and comment out the "if(Ext.os.deviceType) {...}" it also runs without error in Safari under iOS (Simulator and Device).
Removing the reference to cordova also makes the app work in the PhoneGap/Cordova shell when run in Simulator or on Device.
Why would including cordova-2.0.0.js and then building in Xcode cause the ST2 code to not update the view?