Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19688] "Could not find the file app.js" when using Xcode to run app

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2020-01-30T11:01:47.000+0000
Affected Version/sRelease 5.0.2
Fix Version/sn/a
ComponentsiOS, Tooling
Labelsn/a
ReporterJong Eun Lee
AssigneeChris Barber
Created2015-10-08T09:55:50.000+0000
Updated2020-01-31T11:13:07.000+0000

Description

Running titanium project in Xcode is very useful when debuging and using native module. But, When I run titanium app in Xcode, I got the red error screen "Could not find the file app.js"

Reproduce steps.

- create titanium mobile project (alloy or classic) - Build your project via Studio or CLI, then close the simulator - open yourproject/build/iphone/yourproject.xcodeproj in Xcode. - Build & run the project within Xcode. - Finally, you got a error message

Comments

  1. Chris Barber 2015-10-08

    You must set the Xcode derived data paths (under Prefs > Locations > Derived Data > Advanced) to Custom using build/Intermediates and build/Products. Secondly, you must never clean the Xcode project.
  2. Jong Eun Lee 2015-10-09

    Thanks. After setting the Xcode derived data path "Cusom relative to workspace", it works. And, as you mentioned, after cleaning Xcode project (menu Product>clean) it doesn't work again. How can I make it works again? http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Project-section-43288810_iOSModuleProject-LinktheTestApplicationandtheModuleProjects When developing iOS module and you need to link the Test Application and the Module Projects for debugging, [step 8 of your guide](http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Module_Project-section-43288810_iOSModuleProject-LinktheTestApplicationandtheModuleProjects) is "Product > Clean" How can I do "Link the Test Application and the Module Projects"?
  3. Maico Cardoso 2015-11-03

    I tried it and not have solution, my environment is equal to this case. I don't have ideia that i can do to resolve it. Please fix this bug.
  4. Chris Barber 2015-11-03

    [~maicojc] Running directly from Xcode is not supported. You can do it, but it's not something that we test or advocate. If you build your Titanium app for the simulator, then you cannot open the Xcode project and build it for device. You cannot clean the project from Xcode. You must set up the derived data paths.
  5. Olivier Morandi 2015-11-03

    Chris, as far as I remember, the possibility to build directly from Xcode has been supported by Titanium SDK for the last ~5 years or so, and it's quite important for anybody willing to seriously debug native iOS modules. Removing this kind of support will make the life of native iOS module devs harder, unfortunately making it close to the experience of debugging native Android modules, which is far from smooth.
  6. Chris Barber 2015-11-03

    [~omorandi] We've never officially "supported" building directly from Xcode. We don't test it. It does work if you know what you're doing. I hear you on developing native modules. It's a huge pain, but it is possible.
  7. Maico Cardoso 2015-11-04

    Thank you Oliver Morandi and Chris Barber unanswered. I'm creating apps for Titanium since 2011 and always compiled by the simulator Titanuim and then the device by XCode. This is the first time I'm having trouble. As Oliver said, he relied on Titanium as this gives me a native app. I feel for this practice is not the official Appcelerator.
  8. Lee Debnam 2015-11-04

    I'm having the exact same issue under the same circumstances. One of the reasons we use Titanium here is the ability to have the native code in Xcode so this is a massive issue for us.
  9. Chris Barber 2015-11-04

    [~ldebna] You can build from Xcode, you just can never clean the Xcode project, you must set up the derived data paths, and you only build your app for the same target that the Titanium app was built for (i.e. you can only build for simulator with a simulator build of your Titanium app).
  10. Soumya Kanti Kar 2015-11-05

    We are getting the same issue when we want to profile the application (from Xcode even after changing the derived sources as specified). The alternative is to run the application from Appcelerator Studio in simulator, then close the application on simulator, launch instruments, select the installed application to debug and then start the recoding button. This will launch the application and start profiling.
  11. Rene Pot 2015-11-16

    I had issues like this too without using xcode directly, I have never used xcode to compile my apps, I always use Titanium. Though, I haven't seen the error in a while, it was with iOS for sure
  12. Vaughan Barwood 2016-06-03

    I have been using this process for 3-4 years now and have only experienced this bug this week. I have tried a lot of work arounds but no joy until now. My issue is trying to supply an xCode project to a client. Here is my fix: * Build your project via Studio for "Distribute - Apple iTunes Store" or "Distribute - AD Hoc/Enterprise" * Goto 'yourproject/build/iphone/' using Finder * If there is an 'assets' folder. Deletes it's contents. If there isn't create one (yourproject/build/iphone/assets') * Copy from your Titanium projects 'Resources' folder all JS files (keep any folder structures you have used to organise). Obviously include you app.js file. * Within the 'yourproject/build/iphone/lib' folder replace the alias's with the originals. These can be found by right clicking and selecting 'Show original' * Open yourproject/build/iphone/yourproject.xcodeproj in Xcode. * Build & run the project within Xcode Now it should build/run not only on your machine but also a teammates or clients. EDIT: Build your project via Studio for "Distribute - Apple iTunes Store" or "Distribute - AD Hoc/Enterprise"
  13. Rene Pot 2016-06-03

    So far I've only been able to reproduce this when the original project was build using LiveView.
  14. Alberto Marcone 2016-07-28

    none of the workarounds works for us.
  15. Vaughan Barwood 2016-07-28

    @Alberto if you are really stuck and need support, ping me an email (vaughan@onefoursix.digital). We have been having to use a workaround for a few weeks now, but our solution does work and I'm happy to help.
  16. david hoare 2016-10-17

    Hi, We've been having a heck of a time with this issue... Now I'm getting an "undefined is not an object" error when trying to simulate the app via the xCode package after building with titanium, despite adding the resources folder and original lib files, as Vaughan recommended... Vaughan - were there any other steps you took to solve your problem? It appears, by the error that it's loading the app.js file, but bugging out on a variable assignment: vars.app_screenshot. In our code, the "vars" object is read from a json config file located in a subfolder of the resources folder... it's not specifying a file-read error, but maybe it's not finding that file, hence the variable error? Any ideas, or even how to go about testing it? Thanks in advance for any light you might be able to shine on this :-) {{[DEBUG] Reading stylesheet from: /Users/davidhoare/Library/Developer/CoreSimulator/Devices/19C2CCD9-7970-48CD-88B8-20A5ED3B444A/data/Containers/Bundle/Application/4230EEB8-4383-4D79-A1FB-A7E2D2233F51/test_func3.app/stylesheet.plist [INFO] test_func3/51 (5.4.0.4ba4c0a) [DEBUG] Loading: /Users/davidhoare/Library/Developer/CoreSimulator/Devices/19C2CCD9-7970-48CD-88B8-20A5ED3B444A/data/Containers/Bundle/Application/4230EEB8-4383-4D79-A1FB-A7E2D2233F51/test_func3.app/app.js, Resource: app_js [DEBUG] Loading: /Users/davidhoare/Library/Developer/CoreSimulator/Devices/19C2CCD9-7970-48CD-88B8-20A5ED3B444A/data/Containers/Bundle/Application/4230EEB8-4383-4D79-A1FB-A7E2D2233F51/test_func3.app/_app_props_.json, Resource: _app_props__json [ERROR] Script Error { column = 44; line = 148; message = "undefined is not an object (evaluating 'vars.app_splashscreen')"; sourceURL = "file:///Users/davidhoare/Library/Developer/CoreSimulator/Devices/19C2CCD9-7970-48CD-88B8-20A5ED3B444A/data/Containers/Bundle/Application/4230EEB8-4383-4D79-A1FB-A7E2D2233F51/test_func3.app/app.js"; stack = "startup@file:///Users/davidhoare/Library/Developer/CoreSimulator/Devices/19C2CCD9-7970-48CD-88B8-20A5ED3B444A/data/Containers/Bundle/Application/4230EEB8-4383-4D79-A1FB-A7E2D2233F51/test_func3.app/app.js:148:44\nglobal code@file:///Users/davidhoare/Library/Developer/CoreSimulator/Devices/19C2CCD9-7970-48CD-88B8-20A5ED3B444A/data/Containers/Bundle/Application/4230EEB8-4383-4D79-A1FB-A7E2D2233F51/test_func3.app/app.js:91:9"; } [ERROR] Application received error: undefined is not an object (evaluating 'vars.app_splashscreen') at app.js (line 148) [DEBUG] Application booted in 161.387026 ms}}
  17. Vaughan Barwood 2016-10-17

    Without seeing the project I don't know what to suggest. Could you screenshot the directory for the whole xCode project that might help me spot something. Alternatively, drop me a private message and I may be able to help.
  18. michael warnes 2017-05-07

    please fix this and publish any information
  19. Chris Barber 2017-05-08

    [~mike@warnes.com] As stated above: {quote} We've never officially "supported" building directly from Xcode. We don't test it. It does work if you know what you're doing. {quote} {quote} You can build from Xcode, you just can never clean the Xcode project, you must set up the derived data paths, and you only build your app for the same target that the Titanium app was built for (i.e. you can only build for simulator with a simulator build of your Titanium app). {quote}
  20. michael warnes 2017-05-08

    well I've got no choice because I'm getting a iOS: Ad-hoc build fails with 'Invalid "--pp-uuid" value' error consistently as described in TIMOB16325, so basically I'm completely stuck
  21. michael warnes 2017-05-08

    with all due respect, cutting and pasting previous comments is not great sorry
  22. Chris Barber 2017-05-08

    [~mike@warnes.com] In order to better help you, please give us some details as to how you encountered this error. * Are you building from Appcelerator Studio or the CLI? * What version of Titanium SDK? * What version of Appcelerator Studio? * What do the trace level logs say? * What version of iOS SDK? * What command was run to build the app? * What does appc ti info say? If you want, I'd be happy to help you further on https://ti-slack.slack.com.
  23. michael warnes 2017-05-08

    that would be great, I can't get onto that slack channel because it says i'm not a member? Are you building from Appcelerator Studio or the CLI? - studio What version of Titanium SDK? - 6.04GA What version of Appcelerator Studio? Appcelerator Studio 4.8.1.201612050850-05122016085155 What do the trace level logs say? ["titanium"] 2017-05-08T12:53:15.294Z | TRACE | Attempting to load session info from config file 2017-05-08T12:53:15.296Z | TRACE | check if session is invalidated 2017-05-08T12:53:15.513Z | TRACE | refresh session expiry to: 1494852795375 2017-05-08T12:53:15.514Z | TRACE | session expiry 1494852795375 false 2017-05-08T12:53:15.514Z | TRACE | session already loaded in opts.session 2017-05-08T12:53:15.516Z | DEBUG | Titanium Downloads Last Checked: 1494170092842 [ERROR] : Invalid "--pp-uuid" value "63169b73-5868-4080-9671-d34ce128c458" For help, run: titanium.js help build What version of iOS SDK? What command was run to build the app? using the publish command What does appc ti info say? - will attach once I can work out how
  24. Vaughan Barwood 2017-05-08

  25. michael warnes 2017-05-08

    all sorted, it was my fault because I had not created an ad-hoc provisioning profile, I had created a distribution profile. Chris helped me to realise that by asking for the output from ti info. I extremely grateful for your help, thank you very much
  26. Rene Pot 2018-01-05

    I'm guessing this ticket can be closed then, as the issue is resolved by itself
  27. Sohail Saddique 2020-01-31

    Ticket closed.

JSON Source