Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5320] iOS - functions declared in alloy.js are not globally visible

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNot Our Bug
Resolution Date2017-11-07T05:23:48.000+0000
Affected Version/sAppcelerator Studio 4.3.0
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsios, regression
ReporterAndrea Vitale
AssigneeShak Hossain
Created2017-10-29T11:00:17.000+0000
Updated2017-11-07T05:23:48.000+0000

Description

Declare a function in _alloy.js_
function test() {
    Ti.API.info("Hello!");
}
and try to invoke it in _index.js_ an you will see:
[ERROR] ReferenceError: Can't find variable: test
[ERROR] File: app.js
[ERROR] Line: 31
[ERROR] SourceId: <null>
[ERROR] Backtrace:
[ERROR]  undefined
on Android is working as well.

Comments

  1. Sharif AbuDarda 2017-10-29

    Hello, I can't reproduce the issue in iOS simulator 11.0, I define your function in alloy.js and call the function in index.xml in a button click event. The event fires fine for simulator build. Can you share a full code for this?
  2. Mostafizur Rahman 2017-11-01

    [~Andrea.Vitale], Can you please test the sample code from [here](https://gist.github.com/rakhimoni/e15cc150f82dbf0d5d5ff7ddd31b40a8) on your end and let us know how it goes. Thanks
  3. Mostafizur Rahman 2017-11-05

    Hello [~Andrea.Vitale], Did you manage to test sample code provided earlier? Best
  4. Andrea Vitale 2017-11-06

    Hi @Mostafizur, I tested your code and is working as well. Also my sample code that I tested before to open this issue now is working maybe due to the CLI that was outdated. Really don't know but is working. You can close this issue, thanks!

JSON Source