[AC-6297] Please check the following bug i have found in SDK 8.1.0.v20190619134801
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Invalid |
Resolution Date | 2019-07-02T22:15:25.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android |
Reporter | Andreas Pingas |
Assignee | Shak Hossain |
Created | 2019-06-28T12:11:31.000+0000 |
Updated | 2019-07-02T22:15:26.000+0000 |
Description
Please check the following bug i have found in SDK 8.1.0.v20190619134801
Please us the attached code
In the older SDK version i get the following:
[INFO] : Ti.Platform.isIOS TEST 1 false
[INFO] : Ti.Platform.isIOS TEST 2 false
[INFO] : Ti.Platform.isIOS TEST 3 false
at SDK SDK 8.1.0.v20190619134801 i get the following
[INFO] : Ti.Platform.isIOS TEST 1 false
[INFO] : Ti.Platform.isIOS TEST 2 undefined
[INFO] : Ti.Platform.isIOS TEST 3 false
Attachments
File | Date | Size |
app.js | 2019-06-28T12:10:31.000+0000 | 156 |
templates.js | 2019-06-28T12:10:33.000+0000 | 196 |
[~andreas.pingas], I'm not going to accept this as a bug. This was unfortunately intentional. Here is why... On Android, every JS file has its own "copy" of core Titanium modules such as
Ti.Filesystem
,Ti.Media
,Ti.UI
, etc. This is true even in older versions of Titanium. The negative consequence of this is that whatever methods/properties you add to that core Titanium module will not be available to any other JS file. This was an intentional design decision made on Android years ago to support file paths relative to a JS file that it was called in. I don't personally agree with it (doesn't match iOS' behavior), but that's how it works for now. The reason you're seeing this in Titanium 8.1.0 now is because we added relative path support toTi.Platform.openURL()
andTi.Platform.canOpenURL()
. For example, run the below code on both Android and iOS. The below will log if the core library references match between the "app.js" and "foo.js" scripts. Notice that it'll return false on Android forTi.UI
andTi.Media
on older SDK versions, but they return true on iOS. app.jsfoo.js
---- What I recommend that you do instead is set up your own properties/methods in the "global" namespace. For example...
---- Alternatively, if your goal is to simply identify the platform, then a simpler solution that works for a Classic Titanium app is to do the following...
ok, thanks!