Delphi XE2 Update 4 adds a very significant extension to FireMonkey on iPhone and iPad: The Ability to create DataSnap client applications for these devices in a very simple way. This is an extremely relevant element of the FireMonkey architecture, and pushes it considerably, that's why it is a bit odd this is not mentioned in the Release Notes for Update 4. maybe they want to keep this secret... of offer it as a surprise to the webinar this Wednesday on Mobile development. If this is the case, sorry to spoil the surprise. Enough preamble, let's see what's available and how to proceed.

First, create a DataSnap server application of any kind, use HTTP (as we are going to use the REST) interface, and enable the use of the Mobile Connectors:

Now run the DataSnap server and connect to it to download the FreePascal support units and proxy class:


Copy these files in a folder, create a new FireMonkey HD iOS application,, saving it in the same folder, add an edit box and a button, and write the following code:

Not the best coding style (for the repeated initialization and missing try/finally blocks) but should give you a good idea. Of course, change the IP address of the machine hosting the server application as seen from the iOS device (so, no "localhost" allowed). You can now compile in Delphi, but cannot run it, as the connection object used is specific to iOS. If you run it on Windows you'll get an exception when the connection is created. Still, you can extend the code with IFDEF statements to have a Windows version.

Now export the project to XCode, go to your Mac, open the project in XCode, compile... and you'll likely see an error. In one of the support units, DSRESTConnection.pas there are references to other units with the wrong case ("Rest" instead of "REST") and since the Mac file system is case sensitive, you'll get compiler errors. Fix this, compile and run, and the program can show up on your phone in a second. Here is it on my iPad (kind of a bare form, but this was just a proof-of-concept):  

The program works and all the development took less than 15 minutes, plus the time to found the bug. Very fast and clean. I've already created another more complex client application with the same structure.