{ "id": "172973", "key": "TIMOB-26807", "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": null, "resolutiondate": null, "created": "2019-02-07T23:18:22.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "cb-tooling", "engSchedule" ], "versions": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "issuelinks": [ { "id": "57167", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "173032", "key": "TIMOB-26840", "fields": { "summary": "iOS: The xcode project created upon build of titanium project gives error when run to iOS device", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "57758", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "173668", "key": "AC-6266", "fields": { "summary": "Some assets JS file are missing in final build (.iPA)", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "57927", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "174445", "key": "TIMOB-27612", "fields": { "summary": "iOS: Not able to debug Swift module", "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" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "58177", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "174721", "key": "DAEMON-321", "fields": { "summary": "@appcd/plugin-titanium: ti add command", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2021-08-21T20:34:44.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "Until SDK 7.5.X one could open the Xcode project from a device build ({{-T device}}) and simply run it via Xcode. This was very useful for easy native debugging of both the SDK core and natives modules.\r\n\r\nSince SDK 8.0.0 this is now failing due to the core-js polyfills which are added to the app outside of our usual JS processing and thus are not part of the encrypted JS assets.\r\n\r\nApart from the issue mentioned in this tickets this may also have a negative performance impact since i would assume loading the polyfills from the encrypted assets is probably faster then loading them all from file.\r\n\r\n*EDIT:* With latest master the issues with polyfills were resolved. Only the {{__index__.json}} used to resolve require paths is still required.\r\n\r\nAs a workaround the following build phase can be added to the Xcode project which copies the required files into the app bundle:\r\n{code}\r\ncp ${SRCROOT}/build/Products/Debug-iphoneos/${CONTENTS_FOLDER_PATH}/_index_.json ${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/_index_.json\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS: Missing files when running from Xcode project", "creator": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "446422", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Building an app directly from the generated Xcode project has NEVER been supported. It can work, but you can't clean the project. I plan to address this with the rewrite of the iOS build for the new build pipeline.\r\n\r\nAlso note that there are other tickets out there that are related to building projects from Xcode. This ticket should likely be a dupe.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2019-02-28T21:09:01.000+0000", "updated": "2019-02-28T21:11:52.000+0000" }, { "id": "448511", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "This topic pops up every few months - since years. If Titanium could just inject the above build script, devs are FINE. No rewrite or larger changes required; the benefits for real word developers struggling with this would be huge.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-05-19T15:56:35.000+0000", "updated": "2019-05-19T15:56:35.000+0000" }, { "id": "448531", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I'm fine with adding the 4 lines in the description to the existing \"Pre-Compile\" build phase. I would prefer we not add a new build phase as that would require a change in the iOS build script.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2019-05-20T18:19:01.000+0000", "updated": "2019-05-20T18:19:01.000+0000" }, { "id": "448595", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Sounds like a plan! [~jvennemann] I am getting \"directory not found\" errors when using this in latest 8.1.0 master, but it works without it as well.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-05-22T17:39:44.000+0000", "updated": "2019-05-22T17:39:44.000+0000" }, { "id": "448604", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~hknoechel], only the last line is required with the latest master builds. The other issues with the polyfills seem to have been resolved in the meantime.\r\n\r\n[~cbarber], what existing \"Pre-Compile\" build phase do you mean? AFAIK, the Xcode project does not contain any existing \"Run Script\" build phase we could use for this.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-05-22T22:26:44.000+0000", "updated": "2019-05-22T22:26:44.000+0000" }, { "id": "448611", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Why not just add the file to the usual build copy-phase? We copy a LOT to the built product, so this one file won't make a huge difference I assume.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-05-23T06:47:03.000+0000", "updated": "2019-05-23T06:47:03.000+0000" }, { "id": "454148", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Is this really still an issue? The _index_.json file appears to already be in the build/Products/Debug-iphonesimulator directory, so when I hacked our iOS CLI build to re-use the Pre-Compile build phase and then copy the file as suggested above, it's failing simply because the file already exists (and both the src/dest paths in the command resolve to the same file path!)", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-02-10T15:03:54.000+0000", "updated": "2020-02-10T15:03:54.000+0000" }, { "id": "454157", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I just did a test. I built an Alloy app with Titanium SDK 9 (master). I open the Xcode project and try to run it and it blows up with \"Could not find the file ti.main.js\".\r\n\r\nAfter doing some testing, I determined Xcode uses a system DerivedData directory to build the app. This directory is outside the Titanium project and thus does not have any of the Titanium resources.\r\n\r\nTo fix the Derived Data directory issue, you must open Xcode Preferences, go to the \"Locations\" tab, then set the \"Derived Data\" path to be \"Relative\" and a value of \"DerivedData\". This will put all intermediate files in the \"build/iphone/DerivedData\" directory. Next you need to click the \"Advanced...\" button under the Derived Data field to open the build location window. Select the \"Custom\" option with \"Relative to Workspace\". Set the \"Products\" path to \"Build/Products\" and the \"Intermediates\" path to \"Build/Intermediates.noindex\". Click the \"Done\" button and close the preferences.\r\n\r\nNow you can build your iOS app and will will run. BUT, don't clean the project! That will wipe all files in the \"build/iphone/build/Products/Debug-iphonesimulator/appname.app\" directory and then you're back at the \"Could not find the file ti.main.js\" error.\r\n\r\nI recommend we research changing the iOS build so that it copies/processes files from the Resources directory into a \"build/iphone/Resources\" directory instead of \"build/iphone/build/Products/Debug-iphonesimulator/appname.app\". Then add each of those Resources files to the Xcode project as static files that are copied to the final app output directory. This will allow you to clean, re-build, distribute, and natively debug an app without issue.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2020-02-10T19:02:38.000+0000", "updated": "2020-02-10T19:02:38.000+0000" }, { "id": "454172", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cwilliams], yes this is still an issue, precisely because of what [~cbarber] wrote. When you open the project in Xcode it will use a different derived data directory. The command above copies the _index_.json from the derived data directory our command line build uses to the one when you build directly from within Xcode. As you already noted, that's also the reason it fails when you try to hack our iOS CLI because both dest/src are the same in our command line build.\r\n\r\n[~cbarber], your proposed solution is exactly what i had in mind too. We probably \"just\" have to refactor [copyResources|https://github.com/appcelerator/titanium_mobile/blob/f63e597adfc21c4aac6894234b2c92bee4c5a593/iphone/cli/commands/_build.js#L4895] so that it copies all resources to this new destination and then add this as a folder reference to the Xcode project. That way we don't have to manage each and every file reference in the project. Xcode should then just copy it during the \"Copy Bundle Resources\" phase.\r\n\r\nAs an intermediate solution we could start with the {{_index_.json}} and, instead of writing it directly into the Xcode directory, write it into a temp folder and then let Xcode copy it. That way users should be able to run a device build directly from Xcode (since JS resources are encrypted and don't need to be copied).", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-11T12:25:18.000+0000", "updated": "2020-02-11T12:42:48.000+0000" }, { "id": "454176", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Or just add the index.json to the Xcode project. :)", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2020-02-11T14:35:32.000+0000", "updated": "2020-02-11T14:35:32.000+0000" }, { "id": "454191", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Unfortunately that did not work. I included the run script phase from Jan in the main target build phases, but it still complained about the ti.main.js not being found. Has anyone actually tried these steps? I'm running from Alloy, but that should just be a bunch more sources after all.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-02-12T08:52:30.000+0000", "updated": "2020-02-12T08:52:30.000+0000" }, { "id": "454255", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "[~hknoechel] I didn't think that one-liner would have completely fixed it. You would need to do a device build or a sim build with deploy type of \"test\" so that the .js files get encrypted and embedded in the obj-c code, however you'd still be missing any other assets (images, json, html, etc).\r\n\r\nI really think the correct solution here is to add each file (code, images, everything) to the Xcode project when copying files and then write the Xcode project after copying files.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2020-02-13T16:08:39.000+0000", "updated": "2020-02-13T16:08:39.000+0000" }, { "id": "459001", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, so little update here: I found a way to make this working again. We can generate a \"WorkspaceSettings.xcsettings\" with the following contents:\r\n{code:xml}\r\n\r\n\r\n\r\n\r\n\tBuildLocationStyle\r\n\tCustomLocation\r\n\tCustomBuildIntermediatesPath\r\n\tBuild/Intermediates.noindex\r\n\tCustomBuildLocationType\r\n\tRelativeToWorkspace\r\n\tCustomBuildProductsPath\r\n\tBuild/Products\r\n\tDerivedDataCustomLocation\r\n\tDerivedData\r\n\tDerivedDataLocationStyle\r\n\tWorkspaceRelativePath\r\n\tIssueFilterStyle\r\n\tShowActiveSchemeOnly\r\n\tLiveSourceIssuesEnabled\r\n\t\r\n\tShowSharedSchemesAutomaticallyEnabled\r\n\t\r\n\r\n\r\n{code}\r\nwhich is copied to {{/build/iphone/MyApp.xcodeproj/project.xcworkspace/xcuserdata/.xcuserdatad/WorkspaceSettings.xcsettings}}. It can likely even be under {{xcshareddata}} to have less trouble with generating OS-username-depending folders. This will likely cause issues for normal builds, so the build path can/should either be updated to play well with the current one or be injected in a special build mode, e.g. {{ti build -p ios --open-xcode-project}}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-08-21T19:23:20.000+0000", "updated": "2021-08-21T19:23:20.000+0000" }, { "id": "459002", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/13032", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-08-21T20:34:44.000+0000", "updated": "2021-08-21T20:34:44.000+0000" } ], "maxResults": 14, "total": 14, "startAt": 0 } } }