[TIMOB-10914] iOS: When building for iOS devices, the string "Titanium" will be crippled in my application
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2016-08-24T19:28:00.000+0000 |
Affected Version/s | Release 2.0.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | community, core, exalture, parity |
Reporter | Sven Herzberg |
Assignee | Eric Merriman |
Created | 2012-09-12T03:02:41.000+0000 |
Updated | 2017-03-24T21:58:45.000+0000 |
Description
My example application breaks when being built for iOS devices (e.g. via Run on "iOS device"), it does not break in the iOS simulator.
This is an inconsistency that can introduce bugs in software when people just run quick tests in the iOS simulator. Here is my example code:
Even the string fragment
var MyNamespace,
win;
try {
MyNamespace = {};
MyNamespace.Titanium = {};
MyNamespace.Titanium.UI = {};
MyNamespace.Titanium.UI.createWindow = function (params) {
var result = Titanium.UI.createWindow(params);
if (!params.hasOwnProperty('orientationModes')) {
result.orientationModes = [
Titanium.UI.PORTRAIT
];
}
return result;
};
win = MyNamespace.Titanium.UI.createWindow({
backgroundColor: '#fff',
navBarHidden: true
});
win.open();
} catch (e) {
alert("Ooops! Someone broke *.Titanium.UI.*: " + e);
}
This code works as expected in the iOS simulator and on Android device. I have not tested the Android emulator (yet I am confident that it will work). The code does not work on iOS devices yielding this alert message:
Oooops! Someone broke \*.Ti.UI.\*: TypeError: 'undefined' is not an object (evaluating 'MyNamespace.Ti.UI = {}')
Observations:
I cannot reproduce with Titanium SDK master (6.1.0). I suspect this is because we properly AST parse and minify JS code now. I believe this was fixed in 3.0.0 with the iOS build rewrite.
Closing ticket as the issue cannot be reproduced and with reference to the previous comments.