Using Titanium’s

The Titanium Mobile SDK comes with the powerful script that allows you to generate stand alone XCode projects for your existing Titanium Mobile Projects.

The 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 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 script I recommend verifying a few things in your Titanium Project.

  1. Open Titanium Studio and go to your project
  2. 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.
    Verify Titanium SDK Version
  3. After confirming the SDK version we next need to make sure the project has been cleaned. This will ensure that the script performs a full build of your project.
  4. To clean your project click on the Project option in your toolbar then select Clean…
  5. This will open the below dialog box.  Select to either clean all projects or select the one you want to run against.  In the below example I’ve selected to only Clean the bARk project.
    Clean Project
  6. 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 will create it’s files here.
    Confirm Directory Is Empty
  7. You can now close Titanium Studio and move onto running the script as outlined in the next section.

Running The Script

The 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.

  1. Open terminal and navigate to your ~/Library/Application Support/Titanium/mobilesdk/osx/1.8.2/iphone directory
  2. Issue the following command  ./ <path to your project directory>  in my case that is ./ /Users/benjamin/Dev/Projects/Ti/Demos/bARk/ Path Example
  3. You will now is the project building, the output should look like the below. console output
  4. Once the build has completed you will see a message saying “Finished! Share and Enjoy.” finished message
  5. has now generated a stand alone XCode project for you in your Titanium Project’s build/iphone directory.
  6. 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 script generates iPhone, iPad, and Universal targets when running.  It is recommended that you remove any targets you do not need.

Project Targets

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

Deleting a project target

Since bARk is only an iPhone app, I’ve removed all other targets just leaving the below.

iPhone Target

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.

Target Icons

To add an icon you need to right mouse click ( control + shift + click ) on the different image boxes. 

Select Image

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.

Image Finder

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.

All images added 

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.

Default Gloss Effect

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.

Icon Gloss Effect iOS5

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.

Adding a URL Icon

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.

URL Icon Added

What’s Next?

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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s