Tuesday, January 18, 2011

Starting iPhone Development

I come from a .Net background. In fact since less than a year ago I never used a Mac, not even once. At the same time I know my story is not uncommon at all. So I thought I share my experience and mention a few things that helped me big time.

1 – My actual job, like I said, is development; so I know most of the Object Oriented concepts; but I didn’t know anything about Objective C or the Cocoa framework. If you don’t have any programing background I suggest you find some good resources and learn the fundamentals first. If you’re coming from .Net or Java or C++ world, don’t freak out at the first sight of Objective C. I have to be honest, I did. The syntax looks a bit overwhelming at the first glance but then in a short period you realize that it’s actually not that hard to learn, and in fact if someone doesn’t know C++ and Objective C; I think learning Objective C syntax would be easier (though I don’t have much experience with C++). The other interesting thing is that I found certain concepts in Objective C and Cocoa to be more similar to Java than C++. For .Net developers it’s easy to understand the relationship between Objective C and Cocoa. Objective C is the actual programing language used to write the application, whereas Cocoa is a rich set of high level APIs and libraries that make writing the application easier; sort of like the relationship between C# and .Net framework (though it’s not as tightly coupled).
2 – Before I even bought my MacBook Pro I started watching some videos on YouTube. They were actually for an iPhone course (CS193P 2009) at Stanford University; and the school was generous to upload the videos for the whole course and put them on YouTube. The course is fairly old and covers only iPhone SDK 2.x, but it covers a lot of the fundamentals. If you know the fundamentals, learning version 3 and 4 would be a matter of reading the reference document on Apple’s website. I’m not going to post all the videos, but here’s the link to the first video and you can find the rest of them in there.
3 – At some point you need a Mac; you can’t write iOS or Mac applications on anything other than a Mac. The good news is that Macs are nice; so you’re not really losing anything; and after this point all the development tools are pretty much free (except a registration cost as a developer, which you don’t need to pay until the later stages) At this point I bought my MacBook Pro, downloaded and installed Xcode and the iPhone SDK which are free from developer.apple.com and started playing around with some of the examples and some of the concepts I learned from the Stanford course.
3 – Apple has a lot of resources and their documentations are truly great. What I like about Apple’s documentation is that their intended audiences are actually human beings. Sometimes I catch myself reading something simple on Microsoft’s MSDN website over and over again. Anyways, so developer.apple.com is a great source for resources. I also bought this book called “The iPhone Developer’s Cookbook, Building Applications with the iPhone 3.0 SDK” by Erica Sadun. This is a really nice book; I highly recommend it; BUT it’s not a beginner’s book. Still, even though it’s a cookbook, it’s more than a set of examples and recipes; the author takes the time to explain certain things.
If you think you need a book to cover the basics better, I hear that “Programming in Objective C 2.0” by Stephen G. Kochan is a good book; but I personally haven’t read it.

Another good source is WWDC 2010 session videos that you can get from iTunes U (in your iTunes). There are some nice tips on how to use some tools and overall iOS development process.

4 – After the initial learning curve has passed and you started to develop your real application with your new found knowledge; you need to start thinking about subscribing as an iOS developer in Apple’s website if you want to release your app to the App Store. This isn’t necessary obviously to write your application or to run it in the simulator, but it’s required if you want to test your app on your device or if you want to release it in any shape or form. It’s $99 per year. If you’re sort of tight on budget then I suggest enrolling a little bit later in the development process, but it really depends. If you’re writing an app that requires GPS signal or gyroscope or the camera (features that are only available on the device) then it’s a good idea to test your app frequently on the device. Other than that, the simulator does a very good job of mimicking the device behavior; just remember that the simulator is probably (if you have a decent Mac) faster than your device.

5 – There are certain things I really like in Xcode and there are some I like more in Visual Studio. One thing’s for sure though, Xcode’s profiling cousin, namely Instruments, is truly amazing. It’s rich in functionality and easy to use. Which brings me to my next point. Besides testing your application regularly and following Apple’s guidelines and best practices to ensure that there are no problems with the memory management and the power consumption, I would suggest you profile your application using Instruments often. Instruments is like a window to the inner workings of your application; and it allows you to profile your app in the simulator or on the device.

6 – Once you’ve tested your application and everything seems to be in order, it’s time to prepare the app for the release. I would suggest you distribute it to a number of “testers” first, and make sure it works on the iOS versions and the devices that you have specified. In order to do this you need to generate certain things in iTunes Connect, like the AppId, certificates and provisioning profiles. I will write about these in my next blog, because I think they deserve a dedicated place of their own, and can be confusing. Here’s a good guide from Apple. I will also write about Ads in my later blogs, if that’s the route you’re choosing.

That’s it for now. Best of luck and if you have some suggestions or any question please leave a comment. Thanks.

2 comments:

  1. Your blog is very motivational. It will inspire others to start thinking about Iphone Application Development without even having any programming knowledge.

    ReplyDelete
  2. Wonderful illustrated information. I thank you about that. No doubt it will be very useful for my future projects. Would like to see some other posts on the same subject! These Developers

    ReplyDelete