iPhone SDK: October 2008 Archives

Development for the iPhone is provided by Apple for Mac OS X exclusively. There are several reasons to do it like that - the most important one would be that iPhone OS Frameworks are all available under Mac OS X.

Those of you who would like to play around with iPhone development under Linux or Windows can now follow a tutorial published by IBM on how to use the Eclipse C/C++ Development Toolkit (CDT) to program native applications for the iPhone. This way you can write iPhone applications by using Eclipse IDE on Windows and Linux, too. The only requirement is that you need a jailbreaked iPhone.

As a conclusion I can say that it's quite complicated and by far not as fluent as developing on the Mac OS platform (e.g. Simulator is missing) - but those wanting to experiment on with the iPhone SDK on Windows or Linux will find this tutorial a useful resource.

I kindly mirrored the tutorial on my webserver - you can download it here ...

Unit testing on the iPhone

| | Comments (0) | TrackBacks (0)

Having worked with Objective C to write Cocoa-based applications for Mac OS X, I was already familiar with Unit Tests for Objective C using OCUnit. Those of you who need a introduction to test driven development in Objective C shall take a look at Apple's documentation for OCUnit. When it comes to writing Unit Tests for iPhone applications I was wondering about its support in XCode, the iPhone Simulator and unit testing on the iPhone itself.

Check out the Google Toolbox For Mac

iPhone SDK projects are not setup to be compatible with OCUnit out of the box. Somehow OCUnit does not play nicely with the Cocoa Touch framework. Luckily the Mac Unit of Google took some time and extended the SenTestingKit Framework of OCUnit not only to provide more functionality, but also to be compatible with the iPhone SDK.

To write unit tests you first need the Google Toolbox For Mac. Then setting up your project just involves just a few steps:

  1. Create a new iPhone Target.
  2. Add several files of the Google Toolbox For Mac.
  3. Add a new build phase as the last step of your target.
  4. Edit the Run Script Build Phase and finally run the Unit Tests.

The cool thing is, that the Google Toolbox For Mac has several enhancement to the standard SenTestingKit allowing you to do UI unit testing, automated binding unit testing, log tracking, and unit testing on the iPhone, as well as tools for doing static and dynamic testing of your code.

It supports all of the features described above in the Simulator. In Device mode Google Toolbox For Mac does not support binding unit testing on the iPhone as NSBinding is not supported on the iPhone. To have your tests executed on the phone, make sure your iPhone application's delegate is GTMIPhoneUnitTestDelegate, or calls [GTMIPhoneUnitTestDelegate runTests] when you want your tests to execute. All of your tests should execute as you would expect.

Google Toolbox For Mac has code coverage targets that build with full gcov settings on. You can then use CoverStory to look at the code coverage. CoverStory allows you to easily view the code coverage of your unit tests. The tool has also been created by Google.

Conclusion

I'm happy that it's possible to do TDD when creating an iPhone application. Sad to see that Apple doesn't support OCUnit out of the box for Cocoa Touch - but at least Google provided a very nice extension to OCUnit that allows you to do TDD.

Recent Activity

Monday

  • I tweeted, "Just published a new blog post: How to make UILabel / UITableViewCell to have a dynamic height ... http://tinyurl.com/8s55nb"
Wednesday

  • I tweeted, "Flat is prepared for the party ..."
Tuesday

  • I tweeted, "Good morning Twitterverse!"

More ...

Conferences

Conferences I presented at:

Programming Blogs - BlogCatalog Blog Directory
Creative Commons License
This weblog is licensed under a Creative Commons License. blogoscoop

About this Archive

This page is a archive of entries in the iPhone SDK category from October 2008.

iPhone SDK: September 2008 is the previous archive.

iPhone SDK: November 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.