Friday 16 December 2011

Running Appcelerator project in Xcode.


 Couple of days earlier, I was more busy in finding the best mobile framework suitable for building iOS Apps, without diving into native code.

I came across this Appcelerator Titanium. I found this pretty interesting, But searching for while I could not found that how it could be beneficial for an iOS developer like me.

I was more interested in running the appcelerator project in Xcode. After juggling for a while I managed to do that.
Lets start Munching:

Step 1:  Download the Titanium Studio from : http://www.appcelerator.com/products/titanium-studio/

Now install it on your Mac.

Step 2: Launch the Titanium for the Application folder.
Below is the Titanium IDE



Step 3.  Now Go to File>New>Titanium Mobile Project.

You will see the similar screen as below:


Step 4: Click on Next , Here you can either choose a pre-build template or can go without a template.
























I have selected the Geolocation mobile client template.

Step 5: Hit Finish and you are done.

What you see now is your project in the IDE. On the left pane double click  to the tiapp.xml file.
It will open it for you in the right pane.
This is where you do your project settings, below is the similar screen that you will get.


As you can see under the Resource folder you have your app.js file, which is the main file where you code your javascript.


As you can see on the right side  you have TiApp Editor open and you have your "MyFirst App settings in front of you".

The beauty of this Appcelerator is that you code only once and can deploy for iPhone,iPad,Android, Mobile web.


We are not diving into the programming but as we have selected the GeoLocation mobile client template. Lets see what this template has done for us.

Lets build this project

In between the toolbars you can see the Run button. Click on the small arrow next to it.














>Select the option Run Configurations.

You will see the below screen. Select the Project that you wan to run, for us is MyFirstApp.
Choose the iOS SDK as 4.0 or above not SDK 5 (As for me while choosing iOS SDK 5 it gives error).

After doing this, Click on the Run button.(bottom right)
































> You can see all the logs in the bottom console window.

Now when the build done. You might be thinking that where is the Xcode in this.

I will say here comes the Xcode.

Navigate to the workspace directory that you set while installing or running the Titanium studio.
The path will be like.

yourWorkspaceFolder>MyFirstApp>build>iphone>MyFristApp.xcodeproj

So this is your Xcode project file.
Run it and it will open the Xcode for you.

> Now you have your favorite IDE Xcode in front of you and a project loaded in it.
Then what are you waiting for hit the Build and Run button

Below is what you will see.























> So you can see that we have only used a single template for Geolocation and we have this beautiful app showing your current location. (dont worry simulator does not show the actual location, it will always show the Apple headquarters) 


Final Words:


You can build a whole app using Titanium Studio using just JavaScript.(good for web developers) and can deploy it to the various mobile devices.

If you want to extend your project using the native language i.e using Objective-C, then you have to write modules and then attach it to your existing project.

Here is a tutorial link for that iOS module Development

1 comment:

Pages