Reputation: 518
I am using app level globals in my app and they work fine on iOS. On Android, I get the following error: Cannot read property baseFetchUrl
of undefined.
Does anyone have any suggestions why this would happen?
Ext.application({
name: 'MyApp',
//Development URLs
baseFetchUrl: 'http://xxxx',
baseStoreUrl: 'http://xxxx',
rootApiUrl: 'http://xxxx',
Upvotes: 0
Views: 261
Reputation: 21
i've encountered the same problem - w/o getting the solution (i think it has sth to do with the packaging method from senach, maybe the packaging process scrambles the order of definitions so that therefor the "basFetchUrl" isnt defined yet). Probably the best way is to create an external config file. Example:
Ext.define('AppName.Config', {
singleton : true,
config : {
urls : {
baseUrl : 'http://domain.de/file.php',
superUrl : 'http://domain.de/files.php'
},
},
constructor: function(config) { // with this you create kind of object, simple said
this.initConfig(config);
return this;
}
});
In your app.js add/extend with
requires: [
'AppName.Config' // make sencha loading the file
]
Now you are able to acces those data Urls like:
AppName.Config.getUrls().baseUrl
alternatively you can use (not recommended) AppName.Config.config.urls.baseUrl (would be needed if we forgot to initiate the constructor
Hope this helps (PS. I should definitly do some spell checking before sending my comment, otherwise i have to do to much edits - aint nobody got time for that ;))
Upvotes: 2