As shipped XCode does not have any native method to compile Framework targets for iPhone, however for a project I have been working on there has been a very strong need to create an embedded framework suitable for iPhone/iPod Touch targets. So after a few days of tinkering with some internals of XCode I have created a method that will do just that!
Sincere I have gotten a decent amount of “buzz” for porting libmysqlclient to the iPhone OS; That is my first target to try out.
So with out further ado I present
MySQL Framework for iPhone
This is currently an alpha version of a full fleged framework for iPhone/iPod Touch 3.0. More documentation will be coming shortly. Do note this is not yet intended to be used for production software and is merely a proof of concept for embedded frameworks. Many features are missing from the obj-c abstraction for MySQL and the client is based on libmysqlclient 5.0.67 which is NOT up to date. However tests have shown capabilities of basic connectivity, authentication and queries to 4.1.22, 5.0.45 and 5.1.30 community editions (note no enterprise connections have been tested as of yet).
In order to properly compile apps using the MySQL.framework a few preperation tasks need to be done.
Setup two targets, one specified for iPhone Device 3.0 and one specified for iPhone Simulator 3.0
Add the MySQL.framework from the Device folder as a framework to the Device target.
Likewise add the MySQL.framework from the Simulator folder as a framework to the Simulator target.
Add a Copy Files Build Phase to both targets specified to the type Framework.
Add the respective frameworks to those Copy Files Phases.
Make sure that both targets are using Base SDK in order to allow the compile target to specify the SDK (and frameworks used).
Since I have yet to receive any official response from Sun about the source distribution conflicts between the GNU license and Apple’s distribution licenses, here is a binary release of the static library. This will only allow compilation of device targets to utilize calls from libmysqlclient.
To use this library: make sure to include and copy the appropriate header files into your project ala #include “mysql.h”, add libmysqlclient.a as a existing framework. Completing these two operations will allow applications to be compiled for iPhone/iPod Touch using the libmysqlclient library. All functions will work just as they would in a desktop application compiled against the desktop version of this library.
On release the iPhone and iPod Touch have only one database application available to them; SQLite. This is all fine and dandy if you are looking to locally store data and manipulate records on your device, however this provides no connectivity to an external server. I have taken the liberty to undertake a massive project of porting the base connectivity from libmysqlclient to a build target static library for the iPhone SDK.
Currently my port compiles properly and allows access to the base functions for creating connections, preforming queries and basic concepts of administration. Since Sun’s GNU license conflicts with Apple’s iPhone Developer license in the regards to releasing source code I am awaiting further details from Sun Microsystems for a release of the binary library. As a base test for this API I have started development of a iPhone/iPod native admin application for MySQL, which should near completion soon.