{ "id": "111287", "key": "TIMOB-13113", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2016-08-29T18:13:32.000+0000", "created": "2013-03-17T22:47:38.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "alloy", "android", "build", "cli", "i0S", "simulator" ], "versions": [], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2017-03-22T20:58:07.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "13103", "name": "CLI", "description": "Node-based command line interface" } ], "description": "This one appears straight voodoo but please check it out.....\r\nI am developing my app for iPhone & Android. I often use the iOS simulator while having an Android phone connected to my Mac by USB. Here are the steps to reproduce:\r\n# build for the iPhone simulator\r\n# build for the USB connected Android phone\r\n# running the iPhone simulator I clearly see Ti.Platform.name='android', as well as osname, which of course easily crashes my app on the simulator\r\n\r\nThis must be a brand new bug in the Studio/SDK since I have been developing like this for a few months now, and only recently seeing this weird behavior.\r\n", "attachment": [], "flagged": false, "summary": "Ti.Platform.name and osname ='android' for iPhone simulator under certain circumstances", "creator": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium Studio, build: 3.0.2.201302191606 SDK 3.0.2GA, Mac with Xcode 4.6.1", "comment": { "comments": [ { "id": "242674", "author": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "body": "I am unable to replicate the problem. I followed the steps mentioned, both trying to leave the iOS Simulator running (I do alert the value of Ti.Platform.name every X seconds, or re-building for it. In both cases, I always see the right value.\n\nMaybe, if you can share the code you are using, I can verify if this is a bug on our side.\n\nThanks", "updateAuthor": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-03-18T15:41:13.000+0000", "updated": "2013-03-18T15:41:13.000+0000" }, { "id": "242723", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "OK - I think I tracked it down, and it appears to be an Alloy issue. Here's how to reproduce (note tool versions above):\r\n\r\nIndex.xml\r\n{code:title=index.xml|borderStyle=solid}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\ntestWin.xml\r\n{code:title=testWin.xml|borderStyle=solid}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nindex.js\r\n{code:title=index.js|borderStyle=solid}\r\nfunction doClick(e) { \r\n\tvar win = Alloy.createController('testWin').getView();\r\n\twin.open();\r\n}\r\n$.index.open();\r\n{code}\r\n\r\ntestWin.js\r\n{code:title=testWin.js|borderStyle=solid}\r\nfunction doClick() {\r\n\tif (Ti.Platform.name === 'android') {\r\n\t\talert ('android');\r\n\t} else {\r\n\t\talert('iPhone');\r\n\t}\t\r\n}\r\n{code}\r\n\r\nNow build for iPhone simulator, leave it open and just follow the onscreen instructions :)\r\nThe reason I think it's an Alloy bug is that here's what I see inside Resources/alloy/controllers/testWin.js:\r\n{code}\r\nfunction doClick() {\r\n alert(\"android\");\r\n}\r\n{code}\r\nAlloy turned Ti.Platform.name into a build-time constant and wiped out the \"if\", which I don't believe is the intent. In any case, I guess the iPhone simulator is for some reason using the file in the Resources directory which was later created for the Android build.\r\n\r\n", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-03-18T19:10:53.000+0000", "updated": "2013-03-18T19:16:04.000+0000" }, { "id": "242725", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-03-18T19:21:14.000+0000", "updated": "2013-03-18T19:21:14.000+0000" }, { "id": "242907", "author": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi, good catch. I did replicate with the steps you provided. Moved the bug to ALOY-571", "updateAuthor": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-03-19T14:26:56.000+0000", "updated": "2013-03-19T14:26:56.000+0000" }, { "id": "242909", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I don't know if there's much I can do about the iOS sim using files in the Resources directory. It is necessary for Alloy to modify those files on each build so that the proper conditionals are used. I'll take a look into the situation though to narrow down exactly what is happening.\n\nWhat version of Alloy are you using?", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-19T14:46:48.000+0000", "updated": "2013-03-19T14:46:48.000+0000" }, { "id": "242915", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "I'm using stock 3.0.2GA tools - i.e. Alloy 1.0.0\r\nThis bug was a nasty one to hit, until the realization came that it was related to Android builds.\r\nSince Alloy rewrites the Resources directory, perhaps what is needed is an arch-specific Resources???\r\nBTW - I don't believe this was occurring in pre-1.0.0 (not 100% sure on that, but close to it....)", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-03-19T15:47:47.000+0000", "updated": "2013-03-19T15:49:56.000+0000" }, { "id": "242925", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In talking with Chris Barber he told me that all files from the Resources folder are symlinked to the ios simulator. This means when changes occur to those files, they show up in the ios simulator as well. This is what is causing this problem. For the time being I'm going to move this to TIMOB. WHile this issue presents itself in Alloy, it may need to be handled at the platform/CLI level.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-19T16:49:09.000+0000", "updated": "2013-03-19T16:49:09.000+0000" }, { "id": "243034", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified as reproducible using TiSDK 3.0.2.GA and 3.1.0.v20130319082237 - Alloy 1.1.0 master - Xcode version 4.6", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-19T21:29:17.000+0000", "updated": "2013-03-19T21:29:17.000+0000" }, { "id": "243566", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~fcasali] Can you get around the issue by cleaning the project?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-21T22:29:17.000+0000", "updated": "2013-03-21T22:29:17.000+0000" }, { "id": "243570", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Federico can confirm, but I don't think that would help since a clean shouldn't impact the files in the Resources folder, where this issue is originating.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-21T22:41:43.000+0000", "updated": "2013-03-21T22:41:43.000+0000" }, { "id": "243573", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Got an idea. I added a simulator-only flag in 3.0.2.GA that copies all resources instead of symlinking them. Simply do this:\n\n{code}\nti build -p ios --force-copy\n{code}\n\nNow, remembering --force-copy is going to be a pain, so add this before the \"build.pre.compile\" hook in Alloy's CLI plugin:\n\n{code}\ncli.addHook('build.pre.construct', function (finished) {\n cli.argv['force-copy'] = true;\n finished();\n});\n{code}\n\nThat should do the trick.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2013-03-21T22:55:19.000+0000", "updated": "2013-03-21T22:55:19.000+0000" }, { "id": "243577", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I assume that --force-copy will have a more-than-negligible hit on build time? I'm comfortable with this option existing and simply pointing it to developers that want to use it rather than imposing a potential build time speed decrease on all developers who couldn't care less. Unless I'm wrong about the time it takes to copy versus symlink.\n\nIn any case, thanks Chris!", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-21T23:01:48.000+0000", "updated": "2013-03-21T23:01:48.000+0000" }, { "id": "243596", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "@Tony, yes, it will increase build time. In theory subsequent builds would copy only the files that changed, but the build scripts are that smart. In the meantime, I recommend upgrading to an SSD.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2013-03-21T23:43:30.000+0000", "updated": "2013-03-21T23:43:30.000+0000" }, { "id": "243603", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "lol, I'll be sure to have the docs guys add that advice to the guides.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-22T00:00:44.000+0000", "updated": "2013-03-22T00:00:44.000+0000" }, { "id": "243785", "author": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "body": "iPhone simulator behavior looks totally dependent of the Resources folder, so cleaning the project does not change the behavior.\r\nChanges in the behavior can be obtained if removing/rebuilding the Resources folder.\r\n\r\nFor example:\r\n\r\n1. Build on iOS (app is running)\r\n2. Build on Android (app is running). iOS simulator is now relying of files built for Android, so if clicking on the label we get the 'android' label.\r\n3. Instead of clicking on the label, remove the Resources folder and compile them again, this time for iOS (alloy compile --config platform=ios)\r\n4. Click on the label\r\nResult: iPhone label is correctly displayed\r\n\r\nAlso, closing and restarting the iOS app after point 2. , it gives an error, in this case for 'Ti.Platform.Android.physicalSizeCategory' is undefined, for the Resources files are the ones being compiled for Android.\r\n", "updateAuthor": { "name": "fcasali", "key": "fcasali", "displayName": "Federico Casali", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-22T23:30:42.000+0000", "updated": "2013-03-22T23:30:59.000+0000" }, { "id": "251344", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~cbarber] I'm using the --force-copy flag like this o nan alloy app:\n\n{code}\nti build -p ios --force-copy\n{code}\n\nAnd none of my code changes update in the app. I'm seeing the log message that the flag is \"working\":\n\n{code}\nForcing copying of files instead of creating symlinks\n{code}\n\nbut I can't update my app at all. The alloy hook and everything runs, everything recompiles, but something in the --force-copy process is just not updating the files. It's only when I remove the --force-copy flag that this starts working again, thereby putting us in the same position we started in. I'm using version 3.1.0 of the CLI.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-10T18:15:25.000+0000", "updated": "2013-05-10T18:15:25.000+0000" }, { "id": "251349", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "@Tony, OK, I'll have to investigate when I have time.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2013-05-10T18:23:47.000+0000", "updated": "2013-05-10T18:23:47.000+0000" }, { "id": "274734", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~tlukasavage], is this not related to ALOY-760?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-10T23:20:24.000+0000", "updated": "2013-10-10T23:20:24.000+0000" }, { "id": "274767", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~ingo] This is the result of symlinking being used for ios sim builds. ALOY-760 most likely would be an indirect way to workaround this issue. ", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-11T08:48:03.000+0000", "updated": "2013-10-11T08:48:03.000+0000" }, { "id": "394659", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "This is no longer valid. Starting with Xcode 7 and iOS 9, we can no longer symlink files, thus this shouldn't be an issue.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-08-29T18:13:32.000+0000", "updated": "2016-08-29T18:13:32.000+0000" }, { "id": "414943", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T20:58:07.000+0000", "updated": "2017-03-22T20:58:07.000+0000" } ], "maxResults": 22, "total": 22, "startAt": 0 } } }