[AC-6697] Method not defined reference error in Android Classic app using 9.3.2.GA
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Done |
Resolution Date | 2021-06-03T10:40:45.000+0000 |
Affected Version/s | Appcelerator Studio 4.3.0 |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | shishir.roy |
Assignee | Abir Mukherjee |
Created | 2021-04-27T06:24:23.000+0000 |
Updated | 2021-06-03T10:40:45.000+0000 |
Description
Hi Team,
We have a classic app maintained for the long time. After upgrade from 8.2.1.GA to 9.3.2.GA, getting reference error while executing our app.
So we have global methods in *app.js* and we are accessing from other pages without including "app. j's". But after upgrading its throws exception while app executing.
Below sample code for app.js method:
var sampleMethod= function(){}
Same sampleMthod we are accessing in other page without including the app.js. It works well in 8.2.1.GA
I have fixed the issue just including "app.js" in page.
So is there any settings are available to enable the global methods. Instead of changing everyplace.
Please suggest.
[~shishir.roy], this is part of the documented removal of the global scope for variables/functions declared in the app.js file. Please see this blogpost for recommendations https://devblog.axway.com/mobile-apps/how-to-globally-access-variables-and-functions-in-titanium/ Also, this type of question is not really the intention of this issue tracker, I would recommend making use of [ti-slack](https://tislack.org/) in future
Right, like [~eharris] said, this was an intentional breaking-change made in Titanium 9.0.0. All functions and
var
declared variables in the "app.js" (or "alloy.js") are no longer global. If you want them to be global, then you need to do so explicitly. For example, if you want to make the below variable and function global....then change the above to the below. (Note the usage of the "global" object.)
You can then access the above variables globally with the "global." prefix in the rest of your code.