-
2 Jan 2013 12:53 AM #1
Unanswered: Sencha Touch 2.1 build generates a non-working app
Unanswered: Sencha Touch 2.1 build generates a non-working app
Hi,
I've developed a Sencha Touch 2.1 app which runs fine without errors or warnings on development. Using Sencha Cmd 3.0.0.250, I'm also able to build my app without any kind of error (for the record I'm using the skip.sass option because my CSS is already generated). However, the generated build just doesn't work. The app crashes when doing the initial loading and shows the following Javascript error on Chrome:
and Safari:Code:Uncaught TypeError: Object function Window() { [native code] } has no method 'apply' app.js:4962 Class app.js:4962 (anonymous function) app.js:77167
I've tried building my app on testing, production and package modes but none generate a working application.Code:TypeError: 'undefined' is not a function (evaluating 'this.constructor.apply(this, arguments)')
-
4 Jan 2013 5:32 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
- Answers
- 3113
I just generated an app:
cd /path/to/sencha-touch-2.1.0-gpl/
sencha generate app MyApp ../MyApp
and did a build:
cd ../MyApp
sencha app build testing
and launched that build and it worked with no issue for me.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
9 Jan 2013 12:50 AM #3
Thanks for your answer Mitchell,
that works for me too (already tried that). I've found the solution to the problem debugging the generated app.js. Just in case anyone is having a similar issue I'll leave the root of the problem and the solution here. Turns out that there was a missing ";" at the end of a model definition file. I had a model "Section" defined in a file app/model/Section.js like this:
This works fine while testing but when you build the app, Sencha Cmd (production,testing or package) concatenates this file with the rest of the files into app.js, resulting in an invalid javascript code. The solution is to make sure that every .js file is properly ended by a semicolon (";"):Code:Ext.define('MyApp.model.Section',{ extend:'Ext.data.Model', config:{ fields:[ /*the fields*/ ] } })
Code:Ext.define('MyApp.model.Section',{ extend:'Ext.data.Model', config:{ fields:[ /*the fields*/ ] } });


Reply With Quote