Show: Delphi C++
Display Preferences

Creating a FireMonkey iOS App

From RAD Studio XE2
Jump to: navigation, search

Go Up to FireMonkey Applications Guide

Contents

At the XE2 release, only Delphi supports FireMonkey iOS apps:

  • File > New > Other > Delphi Projects > FireMonkey HD iOS Application
  • File > New > Other > Delphi Projects > FireMonkey 3D iOS Application

When you create a FireMonkey iOS project using either of these commands, the FireMonkey iOS project does not have a Target Platforms node in the Project Manager because the iOS platform is already defined in the project. Thus, you do not have to set a target platform for a FireMonkey iOS project.

iOS Forms

You can add additional Delphi forms the same way you do with Windows and Mac OS X applications.

Because the target platform is iOS, and the production (final) executable is built with the Free Pascal compiler, the uses declaration for iOS form units is different from that for other FireMonkey applications:

 uses
 SysUtils, Types, Classes, Variants, FMX_Types, FMX_Controls, 
 FMX_Forms, FMX_Dialogs, FMX_ExtCtrls, FMX_Ani;

The iOS form has specific hardware-dependent properties. For example, the iOS form itself has a different shape or footprint than a standard FireMonkey form, as follows:

  • For a FireMonkey iOS application, the ClientHeight and ClientWidth properties are 480 and 320 pixels, respectively (a vertical shape).
  • For a standard FireMonkey application, the ClientHeight and ClientWidth properties are 400 and 600 pixels, respectively (a horizontal shape).

FireMonkey iOS Workflow

At different times during the FireMonkey iOS development process, you need to work either on your development platform or on the Mac. After you convert your project (using dpr2xcode.exe) and transfer the converted project to the Mac, you need to recompile your iOS app using Xcode on the Mac.

Important: Start Here: FireMonkey Development Setup for iOS

  • Before starting your first iOS project, you must perform several important installation and setup steps on both the Windows and Mac. For example, you need to provide a Development Provisioning Profile for any specific iOS development devices you want to use in testing your application on the Mac.

Then develop your project in the following general sequence:

Steps in RAD Studio

  1. Start your project using either of the FireMonkey iOS wizards:
    File > New > Other > Delphi Projects > FireMonkey HD iOS Application
    File > New > Other > Delphi Projects > FireMonkey 3D iOS Application
  2. The iOS Form is displayed in the Form Designer.
    Use the Form Designer and Code Editor in RAD Studio to add controls to the form, to set values for properties and events, and to write the code behind.
  3. For prototyping purposes in RAD Studio, run or debug your project using the Win32 target platform.
  4. Save your project files to a shared directory or other media that is accessible to both Windows and Mac. We recommend saving your files directly on the Mac.
  5. Run dpr2xcode on Windows to create (or update) the corresponding Xcode project ready for the Mac (saved in an xcode folder inside the shared project folder):
    • dpr2xcode is provided in your product /bin directory.
    • Run dpr2xcode at least once after creating the project (and whenever you make changes or add new files to the project).
    Note: For instructions on using and automating dpr2xcode, see FireMonkey Development Setup for iOS.

Steps on the Mac and on an iOS Simulator or Attached iOS Device

  1. Using Xcode, open the .xcodeproj file in the generated xcode subdirectory of the shared project.
  2. Run and debug your project in Xcode:
    1. Select the Run command.
    2. Select the device that is to run your app, such as:
      • The built-in iOS Simulator for initial debugging purposes.
      • A physical iOS device, attached to the Mac.

To run your iOS app on an iOS device:

  • Your iOS device must be connected to the Mac by USB cable.
  • You must create a Development Provisioning Profile for testing your application on your development iOS device.
    The Provisioning Profile associates your Apple Developer ID with:

For more information about the workflow for iOS apps on the Mac, see http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/ios_development_workflow/000-Introduction/introduction.html.

Steps on Both Mac and RAD Studio

  1. Continue futher iterations to develop your iOS app, either using the Form Designer and Code Editor in RAD Studio, or using the code editor in Xcode on the Mac.
  2. While you work, make sure to save or regenerate files on each platform so that all the same changes can be seen everywhere.

Compiler and Run-Time Differences

On the Mac, Xcode builds the app using the Free Pascal compiler to run on the Free Pascal run-time library. Be aware that some features of the Delphi compiler and RTL that are available on Windows are not supported by Free Pascal on the Mac, and vice versa.

Component Restrictions for FireMonkey iOS Apps

While you are designing your iOS app in RAD Studio, you can only use components that are supported on iOS devices. However, be aware that the Tool Palette might contain some components that are Windows-only or otherwise not supported on iOS.

For a list of components that might be present on the Tool Palette but that cannot be used in iOS apps, see Components Not Used in iOS Apps. Keep in mind that you cannot use these components in iOS apps, even if they appear on the Tool Palette.

See Also

Personal tools
Previous Versions
In other languages