iphone开发常用开源库4---Useful open source libraries for IPhone Development

Useful open source libraries for IPhone Development

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 Twitterificavailable 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-kNowCocoa 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.

相关文章

我正在用TitaniumDeveloper编写一个应用程序,它允许我使用Ja...
我的问题是当我尝试从UIWebView中调用我的AngularJS应用程序...
我想获取在我的Mac上运行的所有前台应用程序的应用程序图标....
我是一名PHP开发人员,我使用MVC模式和面向对象的代码.我真的...
OSX中的SetTimer在Windows中是否有任何等效功能?我正在使用...
我不确定引擎盖下到底发生了什么,但这是我的设置,示例代码和...