- macOS Application Development
- Contents
- Setting Up Your Development Environment for macOS
- Developing Your Application
- Using Frameworks in Mac Apps
- FireMonkey
- VCL (not available for Mac)
- Mac Objective-C Frameworks (Macapi)
- Resolving Ambiguities: ‘Byte’ and ‘System::Byte’ on macOS
- Exception Handling
- Processing of Mach Exceptions
- CTRL+C and CTRL+BREAK
- Documentation for Mac Libraries
- Deploying Your Final macOS Application
- RAD Studio 11
- Build Apps 5x Faster With One Codebase for Windows, Android, iOS, macOS, and Linux
- The RAD Studio 11 Release Supports High-DPI and 4k+ screens, provisioning for Windows 11, Android 30 API and the macOS 64-bit ARM M1 processor
- Single Code Base
- Windows 11
- Remote Desktop
- High DPI & 4K
- iOS and macOS
- Android
- Accessible Data
- Faster Coding
- Productivity
- Linux
- User Experience
- Cloud Aware
- Extensions
- RAD Server
- Ignite Your Imagination
- Design Beautiful Desktop and Mobile App UIs with RAD Studio
- Code Faster and Smarter with RAD Studio
- Debug Faster with RAD Studio’s Integrated Native Debugging
- Compile and Deploy High-Performance Native Apps With RAD Studio
- Improve the Quality of Your Code with RAD Studio
- Collaborate Better With RAD Studio Teamwork and Remote Desktop Features
macOS Application Development
Contents
You can use RAD Studio to create macOS 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 RAD Studio 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 Delphi compiler for macOS 64-bit is DCCOSX64.
Setting Up Your Development Environment for macOS
- Physical Connection: Ensure that RAD Studio can connect with the target Mac:
- Click Test Connection in the Connection Profile Manager panel.
However, if the macOS 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 Delphi or C++Builder multi-device application, RAD Studio sets Win32 as the default target platform. To change the target platform to macOS:
- Right-click the Target Platforms node in the Project Manager.
- Click Add PlatformmacOS 64-bit.
The macOS option is unavailable if the application uses VCL (VCL does not support macOS).
- 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).
Developing Your Application
Using Frameworks in Mac Apps
This section describes some aspects of multi-device application development that are specific to the macOS 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.
A number of RTL units are Mac-only (see Mac Objective-C Frameworks). These units are prefixed with the Macapi or Posix unit scope.
FireMonkey
The FireMonkey framework is ideal for the macOS target platform, and it also supports both Win32 and Win64. See FireMonkey Platform Prerequisites.
VCL (not available for Mac)
The VCL is available only on Windows (32-bit or 64-bit).
Mac Objective-C Frameworks (Macapi)
The RTL contains a number of units that provide Delphi 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:
- Macapi.AppKit
- Macapi.AVFoundation
- Macapi.CocoaTypes
- Macapi.Consts
- Macapi.CoreFoundation
- Macapi.CoreGraphics
- Macapi.CoreServices
- Macapi.CoreText
- Macapi.Foundation
- Macapi.ImageIO
- Macapi.Mach
- Macapi.ObjCRuntime
- Macapi.ObjectiveC
- Macapi.OCMarshal
- Macapi.OpenGL
- Macapi.QuartzCore
- Macapi.Security
- Macapi.SystemConfiguration
The FireMonkey framework relies on some of these units.
For help on these API, see the Apple documentation at Mac Developer Library.
Resolving Ambiguities: ‘Byte’ and ‘System::Byte’ on macOS
Both Delphi and the OSX SDK headers define the Byte type. Thus, you might run into ambiguity errors when using plain Byte.
For example, the following code:
To resolve the issue, you should explicitly specify the definition of Byte that you want to use, that is, either of the following:
Delphi | macOS SDK |
---|
For example, the following code should compile with no errors:
Exception Handling
System.SysUtils contains a number of exception classes that represent non-language/hardware exceptions. These exception classes derive from EExternal. The following exception categories are covered:
- Floating-point exceptions
- Integer divide exceptions
- CTRL+C, CTRL+BREAK
- Privileged instruction violations
- Memory access violations
On the Mac, most of the EExternal exceptions originate as Mach exceptions. The only ones that do not originate as Mach exceptions are CTRL+C (EControlC) and CTRL+BREAK (EQuit).
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. (macOS 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 macOS documentation at the macOS Developer Library. RAD Studio 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 Apple 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 macOS Application
Before each release of your macOS application, you should check that every setting is properly configured. See Preparing a macOS Application for Deployment.
To self-distribute your macOS 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.
Источник
RAD Studio 11
Build Apps 5x Faster With One Codebase
for Windows, Android, iOS, macOS, and Linux
The RAD Studio 11 Release Supports High-DPI and 4k+ screens, provisioning for Windows 11, Android 30 API and the macOS 64-bit ARM M1 processor
Single Code Base
Create apps for all major platforms with less coding effort. Write once, compile everywhere.
Windows 11
Modernize VCL apps for Windows 11 with up-to-date user interface controls, WinRT APIs, and HighDPI-related features
Remote Desktop
Collaborate more effectively with remote teams using improved remote desktop support for VCL and IDE
High DPI & 4K
High-DPI support in the IDE, with full support for the latest 4k+ monitors, and cleaner and sharper fonts and icons throughout. Improved FMX High-DPI support for Windows and Desktop with a visibly superior desktop UI
iOS and macOS
macOS 64bit ARM compiler and toolchain that can build universal binaries including Intel/ARM versions for AppStore submissions
Android
Support for the latest Android 30 API and latest Billing APIs, and migration to use the AndroidX libraries. Android support for multiple classes.dex files, simplifying integration of external Android dependencies
Accessible Data
Connect to over 20 databases natively with FireDAC’s high speed direct access, including InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, DB2, SQL Anywhere, Advantage DB, Firebird, Access, Informix, MongoDB and more
Faster Coding
Smarter code navigation when refactoring. Auto code completion with Tab key. LSP awareness of Include files. Auto restart of LSP server. Class helper support. Array suggestions when assigning arrays
Productivity
VCL Styles with design-time support: Prototype stylish UIs even faster by seeing immediately at design-time how your styled forms and controls will look when running.
Linux
Develop both server and FireMonkey GUI applications for Linux
User Experience
Completely rebuilt Welcome Page with a native look and feel, and a UI that fits the IDE, and customizable layout and content
Cloud Aware
Use the HTTP and REST client libraries, available on all platforms, to invoke REST services or AWS and Azure components.
Extensions
Develop and expand the IDE with your own components and IDE plugins, or find ready to use add-ons from our rich third-party ecosystem
RAD Server
Reduces the complexities of rapidly building and deploying a multi-tier turn-key enterprise REST API application server with Swagger support.
Ignite Your Imagination
Design Beautiful Desktop and Mobile App UIs
with RAD Studio
- Use RAD Studio’s award-winning VCL framework for Windows and FireMonkey (FMX) visual framework to create cross-platform responsive UIs
- Enjoy the new high-DPI compatible IDE on 4k+ screens
- Use VCL Styles at design time! Prototype stylish UIs even faster by seeing immediately at design-time how your styled forms and controls will look when running.
- FireMonkey design-time guidelines: Prototype faster with visual lines and enhanced margin and padding support
- Multi-monitor and multi-window improvements: design and edit code for the same form at the same time in multiple windows
- Rapidly design your master responsive UI layout once, then easily customize platform-and-device-specific views without duplicating design effort
- Use the visual design menu to easily drag and drop visual and non-visual components from the palette
- Connect user interface elements to data sources using the LiveBindings Designer
with RAD Studio»>
Code Faster and Smarter with RAD Studio
- Quicken lengthy compiles with highly optimized compilers for every platform
- C++ Code Formatter: Automate the layout of your C++ code using clang-format
- Customize the IDE for two robust and powerful languages (Delphi and enhanced C++) and your coding style
- Use Code Insight™ for code completion via a modern Language Server Protocol based on your code and libraries to help you code quickly and accurately
- Get hints and tips from inline documentation as you code
- Keep development agile with the VCL designer, Agile refactoring and Live Templates
- Integrate with version control systems including Git, Subversion and Mercurial
Debug Faster with RAD Studio’s Integrated Native Debugging
Compile and Deploy High-Performance Native Apps With RAD Studio
- Provision your apps for Windows 11! Be ready for Microsoft’s new release.
- Support for Microsoft’s WebView 2 control (Edge Chromium) in the WebBrowser component
- Go from Ad Hoc to App Store fast. Rapidly produce application bundles that can be deployed to Windows Store (using Desktop bridge), Apple App Store and Google Play Store.
- Compile for macOS (M-series Apple Silicon) and use the new universal package for AppStore submission. You can now compile for both existing Intel, and the new M-series macOS processors (Apple Silicon).
- Compile for Android API 30! Android API and Libraries updated — API 30, Google Play V3, Android X. Keep current with the latest requirements for Android as the platform evolves. — This includes latest billing API
- Define files to deploy by platform and build configuration. Identify within each project the files to deploy based on the target platform (Windows, macOS, Android, iOS, Linux) and build configurations for Debug or Release.
Improve the Quality of Your Code with RAD Studio
- Find coding errors automatically and solve them with fast Error Insight
- C++ toolchain improvements with overhauled Delphi-style RTTI for C++ types, including using typeid on Delphi-style types
- RTL Quality focus: TZipFile, 64bit improvements for large data structures, Bluetooth LE Record Helper for TDateTime in System.DateUtils
- Improved C++-style RTTI for Delphi types
- CMake quality improvements and greatly improved exception handling on both Win32 and Win64
- Use built-in refactoring to streamline, simplify and improve both the performance and readability of your application code
- Leverage well-tested and highly optimized cross-platform libraries to build better code fast
- Build unit tests for all of your code using the integrated DUnit and DUnitX frameworks
- Dive into your project without interrupting the application flow by adding live log-in with CodeSite Logging
- Use Visual Studio Code to edit Delphi source with full code completion
- LSP awareness of Include files and auto-restart of LSP server
- Auto code completion with Tab key
Collaborate Better With RAD Studio Teamwork and Remote Desktop Features
- Use enhanced Remote Desktop support (for VCL and IDE) to collaborate remotely with your team
- Track and manage changes quickly using version control systems including Subversion, Git and Mercurial repositories
- Easily navigate changes and history using the history tab in the code viewer with the built-in difference viewer
- Turn documentation into immediate in-line help for you and your team
- Use RAD Studio command-line compilers ideal for quickly integrating into continuous build configurations using our support for MSBuild or CMake projects
Источник