Tuesday, December 27, 2011

My first iPhone app is finally launched on app store




The STORY
It all began when my Boss said to me "One of client wants iPhone app to be made for their website". Here was my chance to learn iPhone app development. So i said "Yes, i will make this app, i am on it from right now". He then asked for time frame for the app completion. I said everything has to be learned that is why it will take lot of time.

The HARDWARE
After searching on Google i found out that iphone development can only be done on MAC OS not WINDOWS. I went to Apple website for the mac prices and they were pretty expensive. It also came to my mind that at this moment my Boss would not want to buy a pricy machine. According to the investment point of view Bosses do think of the revenue they will generate before buying a machine. In my case it was only one iPhone app, which was still to be developed, so i went online to search for other options. I found MAC OS, which can be installed on an INTEL based machine. The odds of MAC OS able to run whole machine hardware were few. Nothing is better than anything so i downloaded the copy of MAC OS and burned to a DVD. I grabbed a free INTEL Pentium 4 machine from office and successfully installed MAC OS on it. MAC OS was installed on the machine but it was not picking machine's Ethernet and Audio. I went online to find drivers for MAC OS. After several hours i found kext files for machine's ethernet and audio. I copied those files to required folders by reading the instructions written inside the help file. After that i ran a shell script provided with it and ethernet and audio was working fine. me so clever.... right?

The SOFTWARE
Xcode is IDE for developing MACOS and iPhone apps. Xcode consist of an Interface Builder, iPhone/iPAD Simulator and profiling instruments. I already downloaded Xcode 3.1.2 available back then. When i tried to installed Xcode on MAC OS it gave me an error that i can only be installed on versions 10.5.5 and above. I was so much mad at this point as i was so close to start developing my first iPhone app. I again went on Google search and found a solution for tempering MAC OS version. I changed it from 10.5.2 to 10.5.5. Fortunately it solved the error and Xcode was successfully installed on machine. I felt so relieved after trying hello world iPhone app and watching it running on simulator.

The CODE
Objective-C a form is C is used for scripting iPhone apps and it has a different syntax for accessing members and calling methods. Cocoa Touch API is used for making apps for touch devices of Apple like (iPod,iPhone,iPad). Cocoa Touch API written in Objective-C which works as a wrapper for Apple mobile devices with few hardware resources. Cocoa Touch API follows a MVC architecture. I learned to use uicontrols inside cocoa touch such as uitableview, uilabel, uiimageview, uipickerview, uitextfield, uiacitivityindicatorview and etc. I also learned how make http request and get response using NSURLConnection. I also incorporated three20 Api to my app for showing picture gallery. Three20 reduces the hassle of asynchronous downloads preventing developer to write a buggy code for it. Memory management in Xcode is really powerful which enable developers to write error free apps in one go.

The DEPLOYMENT
Simualtor in Xcode gives a quick way to test apps for iPhone and iPad. But it is not enough because it lacks lot of features that is inside a real device like camera, accelerometer, core location etc. Specially, if you are making a game then each test should be done on device. Important thing in deploying app to a device is code signing which involves developer to create a account at Apple Developer Account(ADP). There is $99 fee for creating this account. Using this account you can create provisioning profiles for developer deployment, Adhoc deployment and deployment of Apple App store. I created for developer account provision profile and deployed it to a device for testing. When my app was ready to be launched i code signed my app with Apple App store provisioning profile. After i prepared app store binary i logged in to itunessconnect, i created a new application and filled my app information into. Then i submitted my binary to apple for reviewing. After 7 days my application got reviewed but unfortunately it was rejected not conforming to apple guidelines. They also gave reasons for the rejection. I corrected my iphone app according to the provided reason and resubmitted the binary to apple. But this time i was lucky and my application got published to Apple app store.

Overall EXPERIENCE
The only drawback of MAC OS as a virtual machine is that it can't code sign your app for deployment. I don't know whether MAC OS on VMWARE can do code signing. But it made me realize that its better not to waste more time and purchase a pricy mac. Boss then arranged a used MAC MINI which i further used within deployment phase. Xcode is a great IDE and apple making it more useful for developers by updating it. The worse part is you can't update your already installed Xcode. Every build of Xcode is a new installation. New Xcode 4.0 even have GIT(source version system) incorporated with it,creating provisioning profiles is made easy and it can be done inside Xcode.