To get started with MonoTouch and XCode you will need to install:
Once you have the above, start XCode and create a simple shell that will contain Mono, this is done by following these steps:
The above should launch an empty application in the iPhone simulator.
Device Developers: If you are a registered iPhone developer, you will want to also test that the above application runs on the iPhone or the iPod Touch by changing the Active SDK from "Simulator- XX | Debug" to "Device - XX | Debug" where XX is the version of the SDK that you have installed. Make sure that this application works correctly before proceeding.
To use MonoTouch with your existing Objective-C project, you need to use the MonoTouch Framework. Follow these steps to prepare your project:
The next step is to create a sample C# program that will drive your application, from the File menu create a new file, select "Other" and then "Empty file" and call this "simple.cs"
In this file put the following code:
using MonoTouch.UIKit; class Sample { static void Main (string [] args) { UIApplication.Main (args); } }
You can compile the above program using the MonoTouch C# compiler, like this:
smcs simple.cs -r:monotouch.dll
The next is to embed Mono in your Objective-C code and to have the code call the C# code. The simplest thing is to get the basics generated by the mtouch tool, issue the following command:
$ mtouch simple.exe
The result of running the above command will produce a few files:
You must add all of the *.m and *.s files to your build.