Mac OS X Application Development
Go Up to Multi-Device Applications Index
- 1 Setting Up Your Development Environment for Mac OS X
- 2 Developing Your Application
- 2.1 Using Frameworks in Mac Apps
- 2.2 Exception Handling
- 2.3 Documentation for Mac Libraries
- 3 Deploying Your Final Mac OS X Application
- 4 Mac OS X Topics
- 5 See Also
- 6 Code Examples
You can use Appmethod to create Mac OS X applications, and you can use your Mac as the required intermediate platform for iOS apps.
From the hardware point of view, in addition to the development PC, you need a Mac connected with the development computer (where Appmethod is installed); for example, using a local area network (LAN). See FireMonkey Platform Prerequisites for a list of system requirements, both for your development PC and for the Mac. See also Working with a Mac and a PC.
The Object Pascal compiler for Mac OS X is DCCOSX.
Setting Up Your Development Environment for Mac OS X
- Physical Connection: Ensure that Appmethod can connect with the target Mac:
- Click Test Connection in the Connection Profile Manager panel.
- However, if the OS X app does not have an assigned connection profile, and you attempt to perform an operation that requires a connection profile, the IDE displays the following message:
A connection profile is required for this operation but has not been assigned.
Would you like to assign or create a profile now?
- Then the IDE guides you through the necessary steps in creating a connection profile. On the Platform Properties dialog, you can assign an existing profile to the target platform, or select Add New to create a new connection profile to assign to the target platform instead.
- Platform Assistant: On the Mac, install the Platform Assistant and run it.
- Target Platform: In the IDE, set the target platform. When you create a Object Pascal or Appmethod C++ multi-device application, Appmethod sets Win32 as the default target platform.
- To change the target platform to OS X:
- Right-click the Target Platforms node in the Project Manager.
- Click Add Platform and select OS X.
- Connection Profile: In the IDE, create and assign a connection profile (a group of settings that characterize the connection to your target machine; see Creating and Testing a Connection Profile on the Development PC).
- For C++ Development:
- Xcode and Xcode Command Line Tools:
- For C++, add an SDK, which consists of a set of files (headers and libraries) that are pulled from the machine running the Platform Assistant server into your development system, for compiling and linking. See Adding a Mac OS X, iOS Device or iOS Simulator SDK.
Developing Your Application
Using Frameworks in Mac Apps
This section describes some aspects of multi-device application development that are specific to the Mac OS X target platform. For general multi-device development documentation, see Developing Multi-Device Applications.
Some RTL units that provide basic functionality are common for Mac and Windows, such as System.pas or System.SysUtils.pas.
See also OS X C RTL.
Mac C RTL (for C/C++ Development)
BCCOSX uses header files from several locations for compilation.
- For information about include paths, see "Include Paths (
-I, --sysinc)" in BCCOSX, the C++ Compiler for OS X.
- For information about setting the system root directory, see "System Root (
--sysroot)" in BCCOSX, the C++ Compiler for OS X.
The C RTL is distributed in two locations:
Include Path Type
This directory contains C/C++ RTL Mac OS X header files cached on Windows. It is the SDK root directory.
For compilation, Appmethod requires header files that reside on the Mac in the
Most of the Mac OS X C RTL is standard, and nonstandard characters are not supported.
Mac C Frameworks (for C/C++ Development)
Mac OS X frameworks provide various useful functions for writing platform-specific software. Some frameworks are C-based and can be included in a Appmethod Appmethod C++ project. Some frameworks are Objective-C-based (such as Foundation) and can be used only through Object Pascal interfaces (see the following section).
In order to include a Mac C framework in a Appmethod project, you must edit the SDK that you use. Open the SDK Manager page and click the (Add a new path item) button from the right hand side. In the Add Remote Path Item or Edit Remote Path Item dialog, specify the following:
- Framework remote path (example:
- Framework name (example: CoreFoundation)
Back to the SDK Manager page, press Update Local File Cache to update the SDK local files.
Mac Objective-C Frameworks (Macapi)
The RTL contains a number of units that provide Object Pascal interfaces to Mac frameworks written in Objective-C. These units are scoped with Macapi (from Mac API) and typically located in the
/source directory of your product installation:
The FireMonkey framework relies on some of these units.
For help on these API, see the Apple documentation at Mac Developer Library.
- Floating-point exceptions
- Integer divide exceptions
- CTRL+C, CTRL+BREAK
- Privileged instruction violations
- Memory access violations
If you use assembly routines, then see PC-Mapped Exceptions, Unwinding Assembly Routines.
Processing of Mach Exceptions
For Mach exceptions, the RTL from System.SysUtils creates a thread that listens for exception notifications from the operating system. You just have to include in your code the System.SysUtils unit. When the listening thread receives a Mach exception notification, it transforms the Mach exception into the corresponding Pascal language exception derived from EExternal, as appropriate, and raises/throws the Pascal exception to the user thread that caused the original Mach exception.
If you want to directly work with Mach exceptions, then be aware that, by including System.SysUtils, a dedicated thread is started for listening Mach exceptions. You can investigate the System.Internal.MachExceptions.pas source to make sure you do not interfere with the RTL.
CTRL+C and CTRL+BREAK
For CTRL+C and CTRL+BREAK, the application installs signal handlers. (OS X does not create Mach exceptions for CTRL+C and CTRL+BREAK.)
The SIGINT and SIGQUIT handlers are in conformity with the standards that define the way shell applications must treat CTRL+C and CTRL+BREAK.
We strongly recommend that you do not override the SIGINT and SIGQUIT handlers. However, if you do this, you do not receive EControlC and EQuit exceptions.
Documentation for Mac Libraries
You can obtain the Mac OS X documentation at the Mac OS X Developer Library. Appmethod does not provide help for the libraries you might need to use on the Mac.
You can also register as a Mac developer (free of charge) at the Mac Dev Center. Being a registered member of the Mac Developer Program enables you to distribute apps in the App Store (this is along with other requirements, such as a developer certificate and a provisioning profile). For more information, see http://developer.apple.com/programs/mac/gettingstarted/
Deploying Your Final Mac OS X Application
Before each release of your Mac OS X application, you should check that every setting is properly configured. See Preparing a Mac OS X Application for Deployment.
To self-distribute your Mac OS X application you can simply build your application and distribute the resulting binaries to your clients. See Distributing Applications Outside the Mac App Store in the Apple documentation for more information.
If you want to publish your application on the Mac App Store, however, you must follow some additional steps. See Submit your application to the Mac App Store for detailed steps.
Mac OS X Topics
- Prepare Your Development Environment (OS X):
- Write and Run Your OS X Application:
- Building a Mac OS X "Hello World" Console Application
- Shared Libraries for Mac OS X
- Fullscreen Mode on Mac OS X
- PC-Mapped Exceptions
- Using the Mac OS X Notification Center
- Considerations for Multi-Device Applications
- Deploy Your Application:
- Joining the Mac Developer Program
- Provisioning a Mac OS X Application
- Configuring an Application Entry on iTunes Connect to Wait for Upload
- Preparing a Mac OS X Application for Deployment
- Sandboxing Your Mac OS X Application
- Sandboxing Your Mac OS X Application Manually
- Submitting Your App to the Mac App Store
- Developing Multi-Device Applications
- Differences between Windows and Mac OS X
- iOS Mobile Application Development
- Debugging Multi-Device Applications
- Working with Native and Custom FireMonkey Styles
- FireMonkeyPlatform Prerequisites
- Apple Developer Center
- Mac Dev Center
- Mac OS X Developer Library
- Introduction to Codesigning for Mac
- Submitting Your Mac App to the App Store
- Building for the Mac app store
- Getting Started with Windows and Mac Application Development (E-Learning Series)
- OpenGL Multicolor Tetrahedron (C++)
C:\Users\Public\Documents\Embarcadero\Studio\15.0\Samples\Object Pascal\FireMonkey Desktop\XMLonMac