使用以下内容生成默认应用后
sencha generate app Sencha ../Sencha
我决定在iOS模拟器上测试应用
cd ../Sencha/
sencha app build native
它加载应用程序但卡在加载图标上:
以下是主应用程序(App.js)的代码:
Ext.application({
name: 'Sencha',
requires: [
'Ext.MessageBox'
],
views: ['Main'],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon@2x.png',
'144': 'resources/icons/Icon~ipad@2x.png'
},
isIconPrecomposed: true,
startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
// Initialize the main view
Ext.Viewport.add(Ext.create('Sencha.view.Main'));
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}
});
以下是主视图(Main.js)的代码:
Ext.define("Sencha.view.Main", {
extend: 'Ext.tab.Panel',
requires: [
'Ext.TitleBar',
'Ext.Video'
],
config: {
tabBarPosition: 'bottom',
items: [
{
title: 'Welcome',
iconCls: 'home',
styleHtmlContent: true,
scrollable: true,
items: {
docked: 'top',
xtype: 'titlebar',
title: 'Welcome to Sencha Touch 2'
},
html: [
"You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ",
"contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ",
"and refresh to change what's rendered here."
].join("")
},
{
title: 'Get Started',
iconCls: 'action',
items: [
{
docked: 'top',
xtype: 'titlebar',
title: 'Getting Started'
},
{
xtype: 'video',
url: 'http://av.vimeo.com/64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c',
posterUrl: 'http://b.vimeocdn.com/ts/261/062/261062119_640.jpg'
}
]
}
]
}
});
答案 0 :(得分:3)
将"logger": "no"
更改为"logger": "false"
中的app.json
。当你完成它应该是这样的:
"buildOptions": {
"product": "touch",
"minVersion": 3,
"debug": false,
"logger": "false"
},
然后使用sencha app build native
再次重建。您可以使用sencha app build production
在浏览器中重现相同的错误,然后将浏览器指向http://localhost/path/to/myapp/build/production
。如果您这样做,则必须先清除浏览器缓存(在chrome:wrench-&gt; tools-developer tools-&gt; local storage-&gt; hostname-&gt; X(删除))。
答案 1 :(得分:0)
构建过程在构建过程中创建缩小版本。在浏览器中启动它并检查错误控制台说的内容。
答案 2 :(得分:0)
所以这真的很晚了,但看起来你没有把你的问题标记为已回答,我只花了几个小时试图解决这个问题,结果发现所有这一切都是因为Sencha Docs,用于下载的Sencha SDK工具和实际的Sencha SDK之间存在差异。
希望这会对某人有所帮助 -
如果您的SDK是2.1.0或更高版本,则需要使用Sencha Command 3.0.0(而不是适用于Sencha 2.0的SDK工具)启动基本应用程序。如果你让Sencha Command位工作正常(安装它没有把它放在PATH中,所以我不得不手动添加它)一切都像魅力一样。
http://docs.sencha.com/touch/2-1/#!/guide/command
希望能帮助一些散步者!