How do I run the Xcode project generated by Titani

2019-05-28 23:37发布

问题:

I'm sure it used to be possible to do this but I don't seem to be able to run the Xcode project generated by Titanium in Xcode. The app installs in the simulator and starts but immediately stops with the following runtime error:

Could not find the file app.js

I'm running Xcode 7.2.1 with appc cli 5.1.0 / ti CLI 5.0.5. The app is built with 5.1.2.GA.

Running the app in Xcode would provided access to instruments and perhaps better insight in native level crashes etc.

回答1:

What you are trying to do isn't officially supported, but it is possible.

First, do a clean build of your Titanium app from Appcelerator Studio (or the command line). Then open the Xcode project from the build/iphone directory.

Next, open Xcode's preferences and go to the "Locations" tab. Click the "Advanced" button under the "Derived Data" field. Set the build location to "Custom" and "Relative to Workspace". Lastly set the "Products" location to build/Products and the "Intermediates" location to build/Intermediates. Click "Done" and close the preferences dialog. You only need to do this once.

You can now build your app from Xcode, but there are a few gotchas:

  1. You cannot clean the Xcode project. You'll nuke all your app resources.
  2. You can only build for the same target as you built the Titanium app for in Appcelerator Studio. In other words, you will probably have issues building the Titanium app for iOS simulator, then try building it for device from Xcode. Don't do this.

Again, this is currently not supported. I'm working on greatly improving this developer experience, but it's going to take a while. In the meantime, I hope the above helps.