(relevant for Titainum 1.5.1 as of 1/9/11).
One of the sticking points with developing iPhone apps for me was transitioning to a Mac computer. I've never been a mac person and have always worked on a Windows PC. All of my programming experience has been on a PC. I've developed VBA applications within Excel in addition to numerous websites.
But since you
need a Mac to develop iPhone apps I took the plunge and got an iMac. It's a beautiful computer but have had lots of difficulty transitioning between Mac (developing apps) and my PC (developing websites). Just as installing
xcode (iPhone app development software) and getting that working I found installing Titanium to be a bit of a hassle mainly to my inexperience with a Mac. Here are some problems I ran into to hopefully save you some time.
Titanium does have a very through
guide available on their website. I don't want to rehash what's been created there but here are a few points:
- I have a Mac with OSX 10.6.4 and had no problems with Java. Already had xcode and apple SDK installed so that step was not a problem.
- The android SDK gave me fits.
At first I completely skipped the step regarding downloading the correct SDK, APIs, etc. I know it's right there on the guide but for some reason things looked OK to me. So make sure that your android installation is just like this picture:
I'm still unsure what everything is in the list but this setup allowed me to create android apps. If you're missing something go to the available packages and make sure to check it. Also, after you click to install selected make sure you select "accept all" to make all the packages have a Green check next to them. Otherwise you haven't agreed to the licenses and the packages won't download.
The final step for the android sdk is copying the ADB file into the tools folder. Again, it's all explained in the guide but initially I skipped right over this step. As far as I can tell Google changed the location of the adb file in it's latest SDK release. Titanium, however, needs it to be in a certain place. So, while the guide talks about symbolic links I just duplicated the adb file from platform-tools folder to the tools folder and that did the trick.
You should now be all set to download titanium. You'll want to have the android SDK all ready to go so you know the location when needed by Titanium. Install Titanium and follow the directions on the guide. You'll have to login/create an account. Select the location of the android SDK FOLDER and you're set.
Unfortunately at this point Titanium does not have a built in text editor or IDE. That means while Titanium will do the hard work of creating your app for you your actual programming work has to be done in another program.
Netbeans seems the best for me. I've worked with Eclipse on my PC and Netbeans operates almost the exact same way.
Now, in creating your first app here is a tip:
select "mobile" for Project Type! For some insane reason I could not understand this part in the guide. I saw the screenshot where it says "Installed Mobile Platforms" and had both iPhone and Android selected yet my screen looked like this:
After getting very frustrated and considering shelving the whole Titanium project I realized my mistake.
You have to select Project Type: "Mobile" at the top of the form in order to test your app on the iPhone/Android simulator (the whole point for me!).
- Create new Project in NetBeans
Titanium sets up your directory structure and creates the app.js file which is the entry point for your app. In Netbeans go to "File"->"New Project" and type in your project name. I just used the PHP application template but I don't think it really matters.
For your sources folder select the folder you specified in the step above. Avoid the frameworks. You should now be able to open App.js and see the underlying code. Make a few edits (I changed "I am a window" to "I am Danny"), click save.
Go back to Titanium and under the "test & package" tab select the emulator of your choice and click launch. For iPhone I had no problems and it seems, at least on my computer, to run way faster than the android emulator which takes forever to load.
For the android simulator make sure your SDK starts with "API." So on my computer I have these chocies: 1.6,
APIs 1.6, 2.1-update1,
APIs 2.1-update1, 2.2, and
APIs 2.2. For the emulator to work the SDK selected must start with API (the ones bolded above). Finally, for some reason the Android emulator, when launched, is in locked mode. Sometimes this caused problems so the easiest thing I found was that as soon as possible when the Android Screen popped up drag the lock button from the left to the right side of your screen. Titanium was usually on the "this will take awhile" step (shown in the titanium screen log) so the emulator was usually unlocked by the time Titanium was ready to run my test app.