Difference between revisions of "IPhone Development"
(→Compiling your first iPhone application) |
(→Requirements) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
== Requirements == | == Requirements == | ||
To develop in Eiffel for the iPhone, you need: | To develop in Eiffel for the iPhone, you need: | ||
− | * a Mac running Mac OS X 10.5.7 | + | * a Mac running Mac OS X 10.5.7 or newer |
* the latest iPhone SDK 3.0 and the latest Xcode | * the latest iPhone SDK 3.0 and the latest Xcode | ||
* the official EiffelStudio 6.4 release for the Mac | * the official EiffelStudio 6.4 release for the Mac | ||
Line 48: | Line 48: | ||
For the moment, create a simple iPhone application with Xcode, then compile it for the simulator. Once done, you can type: | For the moment, create a simple iPhone application with Xcode, then compile it for the simulator. Once done, you can type: | ||
cd ~/Library/Application\ Support/iPhone\ Simulator/User/Applications | cd ~/Library/Application\ Support/iPhone\ Simulator/User/Applications | ||
− | and find the directory corresponding to the application you just created. Once done go into that directory and into the Application bundle. Delete the binary and create a symbolic link to the application compiled via EiffelStudio in the W_code directory. | + | and find the directory corresponding to the application you just created. Once done go into that directory and into the Application bundle. Delete the binary and create a symbolic link to the application compiled via EiffelStudio in the W_code directory. Also remove the .nib file in that directory, for otherwise the application may crash during start. |
Now to test your application, you can simply launch the simulator and start your application from there. The simulator is located at: | Now to test your application, you can simply launch the simulator and start your application from there. The simulator is located at: |
Latest revision as of 06:43, 8 September 2009
Contents
Requirements
To develop in Eiffel for the iPhone, you need:
- a Mac running Mac OS X 10.5.7 or newer
- the latest iPhone SDK 3.0 and the latest Xcode
- the official EiffelStudio 6.4 release for the Mac
Getting ready
The iPhone development requires 2 targets and each target has its own value for the environment variable ISE_PLATFORM:
- iphone-x86: when testing under the iPhone simulator
- iphone-arm: when compiling for the actual iPhone device.
Every piece of C code has to be compiled for both targets. Therefore repeat the compilation instructions below twice, one for each target.
Preparing the delivery
Under $ISE_EIFFEL/studio/spec, replicate the macosx-x86 into iphone-x86 and iphone-arm. Do the same in $ISE_EIFFEL/precomp/spec and $ISE_EIFFEL/studio/config.
Compiling
Then you need to check out the source code. The easiest is to create a directory 65dev, go in this directory and then checkout the source code by doing:
svn co https://svn.eiffel.com/eiffelstudio/trunk/Src .
Then set the environment variable ISE_LIBRARY and EIFFEL_SRC to the 65dev directory above.
The Eiffel C runtime
Set ISE_PLATFORM accordingly and in $EIFFEL_SRC/C, type:
./quick_configure
Once compiled do:
cp config.sh $ISE_EIFFEL/studio/spec/$ISE_PLATFORM/include cd run-time cp *.h $ISE_EIFFEL/studio/spec/$ISE_PLATFORM/include/ cp lib* $ISE_EIFFEL/studio/spec/$ISE_PLATFORM/lib/
The Eiffel C libraries
You need to compile some C code. Go in the $ISE_LIBRARY/experimental/library/objc_base/Clib and type
finish_freezing -library
then go in $ISE_LIBRARY/experimental/library/iPhone/Clib and type again
finish_freezing -library
Compiling your first iPhone application
Compile the project in $ISE_LIBRARY/examples/iphone/basic (using the -experiment option). Once done you have a binary called `basic'.
Testing under the iPhone Simulator
For the moment, create a simple iPhone application with Xcode, then compile it for the simulator. Once done, you can type:
cd ~/Library/Application\ Support/iPhone\ Simulator/User/Applications
and find the directory corresponding to the application you just created. Once done go into that directory and into the Application bundle. Delete the binary and create a symbolic link to the application compiled via EiffelStudio in the W_code directory. Also remove the .nib file in that directory, for otherwise the application may crash during start.
Now to test your application, you can simply launch the simulator and start your application from there. The simulator is located at:
/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications
Testing under the iPhone Device
First, you need to create the CECIL archive of your Eiffel iPhone application. To do so, go in either W_code or F_code (I recommend F_code here), and type make cecil. Once you have that, you get an archive file (e.g. libbasic.a).
Create an Xcode project, this time include the CECIL archive and the 2 other C libraries we compiled above as external references. Once done, edit `main.m' so its content look like:
#include "eif_eiffel.h" #include "eif_setup.h" int main(int argc, char *argv[], char **envp) { EIF_INITIALIZE(failure); EIF_PROCEDURE proc; EIF_OBJECT obj; EIF_TYPE_ID tid; tid = eif_type_id ("APPLICATION"); obj = eif_create(tid); proc = eif_procedure ("make", tid); (proc) (eif_access(obj)); EIF_DISPOSE_ALL; }
Compile and deploy to the iPhone and the Eiffel application will be running on your iPhone.