The Titanium Mobile SDK comes with the powerful transport.py script that allows you to generate stand alone XCode projects for your existing Titanium Mobile Projects.
The transport.py script allows you to share your XCode project with clients, third parties, or others that do not have the Titanium SDK installed. You can also use this process to simply the App Store, Ad Hoc, and other processes by directly using Apple’s tools.
I use the transport.py process for all of my release compiles. Below is the process that I follow when using this script.
Before We Get Started
For this example I’m going to use the Titanium SDK version 1.8.2 to create an XCode project for bARk. You can download bARk from github if you want to follow along.
Verifying Your Titanium Project
Before running the transport.py script I recommend verifying a few things in your Titanium Project.
- Open Titanium Studio and go to your project
- When in your project open your tiapp.xml file and confirm the SDK Version is set to the correct version. In this case we are using 1.8.2. as shown below.
- After confirming the SDK version we next need to make sure the project has been cleaned. This will ensure that the transport.py script performs a full build of your project.
- To clean your project click on the Project option in your toolbar then select Clean…
- This will open the below dialog box. Select to either clean all projects or select the one you want to run transport.py against. In the below example I’ve selected to only Clean the bARk project.
- After your project has been cleaned, open Finder and go to your <Project>/build/iphone directory and confirm that it is empty. This is important as the transport.py will create it’s files here.
- You can now close Titanium Studio and move onto running the transport.py script as outlined in the next section.
Running The Transport.py Script
The transport.py is a Python script located in your ~/Library/Application Support/Titanium/mobilesdk/osx/<SDK Version>/iphone directory. This file is available with each release of Titanium so to use a later version update navigate to the correct directory.
For this example we’re using the path ~/Library/Application Support/Titanium/mobilesdk/osx/1.8.2/iphone
To run this script please follow the below steps.
- Open terminal and navigate to your ~/Library/Application Support/Titanium/mobilesdk/osx/1.8.2/iphone directory
- Issue the following command ./transport.py <path to your project directory> in my case that is ./transport.py /Users/benjamin/Dev/Projects/Ti/Demos/bARk/
- You will now is the project building, the output should look like the below.
- Once the build has completed you will see a message saying “Finished! Share and Enjoy.”
- Transport.py has now generated a stand alone XCode project for you in your Titanium Project’s build/iphone directory.
- Open Finder and navigate back to your <Project>/build/iphone directory that we cleaned in the “Verify Your Titanium Project” section.
Moving The Build Directory
Since Titanium often re-generates your project’s build directory I recommend moving the <Project>/build/iphone folder to another location before opening it in XCode. This ensures the project wont be deleted by mistake.
XCode Project Updates
You now can work with your application using XCode directly. Simply click on the .xcodeproj file in your output directory.
The below are a few configuration updates I typically make in XCode before creating a build.
Remove Unwanted Targets
The transport.py script generates iPhone, iPad, and Universal targets when running. It is recommended that you remove any targets you do not need.
To remove a target, simply select the target and press delete. You will be presented with a confirmation box such as the one below.
Press delete to remove the target from your project
Since bARk is only an iPhone app, I’ve removed all other targets just leaving the below.
Verify Icon’s and Splash Screen Configuration
You will want to confirm that your app icons and splash screens are correctly associated with your project.
If you select your target ( in my case bARk) then press the Summary tab at the top you will see all of your icons. You can see in the below sample that we need to set both of our app icons and associate our retina splash image.
To add an icon you need to right mouse click ( control + shift + click ) on the different image boxes.
This will allow you to select an image using the Finder. To select your icons and splash images you want to navigate to the Resources/iphone directory in your build output folder. The below shows an example of the path.
You will want to perform the above steps for any missing images. When completed the Summary tab for your target should look like the below.
Add or Remove Icon Gloss Effect
For some apps you will want to remove the prerendered-icon ( or gloss effect) on the icon.
By default this effect is enabled. To remove this effect select your target, then go to the Info tab. Under the “Custom iOS Target Properties” section you will see a configuration entry called “Icon already includes gloss effects”. Toggle this effect to NO to remove the gloss effect.
See the below screenshot for an example.
In iOS 5 Apple introduced an additional property to control the icon gloss effect. You can update this configuration by selecting your target, then go to the Info tab. Under the “Custom iOS Target Properties” section you want to expand the “Icon files (iOS 5) property and under the “Primary Icon” option you will see an option called “Icon already includes gloss effects”. Toggle this effect to NO to remove the gloss effect.
See the below screenshot for an example.
Adding Icon to your URL Types
You have the ability to set custom URL Types. By default you have a main URL Type for your application.
To add an icon, select your target then press the Info tab at the top of your screen. Then scroll to the end of screen to a section labeled URL Types. To add an icon, click on the icon dropdown box as shown below.
The dropdown will list all of the icons associated with your project. Select the icon you want to use and it will populate the URL icon preview box as shown below.
You now have a full stand alone XCode project.
This can be helpful when performing the following:
- Sending to a client or third party for signing and App Store Submission
- Creating Ad Hoc distributions
- Submitting to the App Store with non Titanium defaults
- Pushing to device using the native Apple tools.
Watch The Video
Below is a video walk through of the above.