Useful open source libraries for IPhone Development

戈嘉慕
2023-12-01

December 21st, 2008 / in IPhone / by keremk /

It’s been almost 3 months since the IPhone SDK’s infamous NDA restrictions were lifted, and there are now a good set of open source libraries available for the IPhone. In this post I will go through the ones that I know of one way or another. If you are aware of more high quality open source projects, please let me know in the comments so that I can update this post.

JSON Library

Currently, there are 3 choices that I know of:

JSON Framework: I used this one in one of my projects, and did not run into problems. Recently after the update to the new SDK 2.2, you may need to make a quick change to your project as outlined at the end of this discussion.

Touch JSON: This one is from the same project owners as the TouchXML.

Blake Seely’s BSJSONAdditions: This one is little older and intended for the Mac originally. According to the author of the JSON Framework a little slower as per his performance benchmarks

DOM XML Library

IPhone SDK includes an event driven (SAX based) XML parser called NSXMLParser. But if you need DOM style parser, you are out of luck unless you use the libxml2 library directly. There is no MacOS X equivalent of NSXML on the IPhone.

However luckily there are at least 2 options that I know of that you might use if you really need the DOM tree:

TouchXML: Open source lightweight replacement for Cocoa’s NSXML cluster of classes based on libxml2.

Matt Gallagher: Wrote a lightweight wrapper on top of libxml2 and describes this in his blog entry.

However note that in a memory and CPU constrained environment like IPhone, it does make more sense to use an event driven parser (probably why Apple decided not to include NSXML in the first place). There is a recent SDK sample called XMLPerformance that shows parsing large number of items in an efficient way using both the NSXMLParser and the lower level SAX parser provided in libxml2.

Google Data APIs

So you would like to access Picasa, Google Calendar, Google Contacts and more… Well there is a very comprehensive ObjectiveC Client Library that you can include as a static library in your applications.

Twitter

Craig Hockenberry of the awesome Twitterific fame, made the source code of the Mobile Twitterific available to serve as a “Best Practices” document. There you can find how to connect to Twitter, get and post tweets etc.

Flickr

Unfortunately the well-known Cocoa API for Flickr is still not ported to the IPhone. However it looks like they are working on porting it to IPhone as of November 2008.

Game Engines

There are at least 3 game engines that I know of:

2D Gaming - Cocos 2D: This one is intended for 2D games, demos and other graphical/interactive applications. It is a port from the Python based cocos2d design. It uses Open ES 1.1, instead of the Quartz 2D and integrates the Chipmunk 2d physics engine.

3D Gaming - SIO2 Interactive: A 3D engine written in C using OpenGL ES.

3D Gaming - Oolong Engine: Mainly written in C++ with some ObjectiveC. Based on OpenGL ES 1.1 and includes the Bullet 3D physics engine.

You can also take a look at some IPhone game source code:

Tris: The source code for the Tetris clone that was pulled out of the Appstore earlier.

Molecules: This is not a game, but serves as a good tutorial for OpenGL ES development.

Unit Testing and Mock Frameworks

As of IPhone SDK 2.2, Apple now includes the OCUnit. This was discussed in the Stanford IPhone Application Programming course and you can download the presentation and the sample. So right of the bat you are now set up for unit testing, no more excuses.

Google actually has a more comprehensive framework in their Google Toolbox for Mac that even includes support for UI testing.

There is also a mock object framework called OCMock that is designed for MacOS X Cocoa, but with a little bit of work you can get that to work for your IPhone projects.

 

 

 

原文出处:http://www.codingventures.com/2008/12/useful-open-source-libraries-for-iphone-development/

 类似资料:

相关阅读

相关文章

相关问答