Native AOT support for iOS-like platforms
Starting from .NET 9, Native AOT supports targeting iOS-like platforms. The term iOS-like platforms refers to Apple platforms that use similar APIs such as: iOS, MacCatalyst and tvOS.
Based on the use case, the support can be divided into:
- support for applications and libraries referencing OS-specific APIs
- support for applications and libraries without OS-specific API dependencies
Support for applications and libraries referencing OS-specific APIs
This refers to .NET MAUI projects targeting OS-specific target frameworks (like: net9.0-ios
).
How Native AOT can be enabled for .NET MAUI apps, see Native AOT deployment on iOS and Mac Catalyst.
Support for applications and libraries without OS-specific API dependencies
This refers to .NET projects targeting the general or non-OS-specific target framework (like: net9.0
), for which Native AOT can be enabled in the following way:
Include the following properties in your project file:
<PublishAot>true</PublishAot> <PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
Publish the project for the desired iOS-like target platform by specifying adequate runtime identifier (later referred to as
<rid>
):ios-arm64
, for iOS physical devicesiossimulator-arm64
oriossimulator-x64
, for iOS simulatorsmaccatalyst-arm64
ormaccatalyst-x64
, for Mac Catalysttvos-arm64
, for tvOS physical devicestvossimulator-arm64
ortvossimulator-x64
, for tvOS simulators
and execute the following command:
dotnet publish -r <rid>
For specifics of building and consuming native libraries on iOS-like platforms, see How to create and consume custom frameworks with Native AOT for iOS-like platforms.