Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28510] iOS: API detection causes strings starting with Ti or Titanium to be inserted as Ti Symbol Macros

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2021-08-06T09:08:15.000+0000
Affected Version/sRelease 9.3.2, Release 10.0.0
Fix Version/sRelease 10.0.2
Componentsn/a
Labelsregress
ReporterEwan Harris
AssigneeEwan Harris
Created2021-07-22T11:03:20.000+0000
Updated2021-08-06T09:08:27.000+0000

Description

Description

_There are probably other cases that cause this, like comments_ If a string starts with Ti or Titanium then it will be detected as Titanium API usage and be inserted into the TI_SYMBOL_MACROS definition. This will then cause a compile error like below if the string is not compatible"
[TRACE] error: conditional compilation flags must be valid Swift identifiers (rather than 'ISSUE?')
[TRACE] error: conditional compilation flags must be valid Swift identifiers (rather than 'ISSUE?TOUPPERCASE')
I think this fix will have two parts: * Firstly, improve the detection of API usage in the babel plugin we use * Secondly, when mapping the symbols, reject any that do not match the format we expect
const win = Ti.UI.createWindow();
win.add(Ti.UI.createLabel({
    text: 'Ti In A String Causes Issues?'.toUpperCase()
}));
win.open();

Steps to reproduce

1. Add the above code to an existing app 2. Build for -p ios -T dist-appstore

Actual

Compile error

Expected

No compile error

Comments

  1. Ewan Harris 2021-07-22

    Note: "Ti In A String Causes Issues?" isn't an issue, but "Ti In A String Causes Issues?".toUpperCase() is This can also be reproduced by building ks-v2 to device
  2. Ewan Harris 2021-07-22

    node-titanium-sdk PR: https://github.com/appcelerator/node-titanium-sdk/pull/451
  3. Ewan Harris 2021-07-26

    titanium_mobile PR: https://github.com/appcelerator/titanium_mobile/pull/12985
  4. Ewan Harris 2021-08-06

    Merged to master and 10_0_X

JSON Source