docs/workflow/building/coreclr/ios.md
This documentation outlines developer workflows for CoreCLR on iOS/tvOS platforms.
Supported host systems for building CoreCLR for iOS/tvOS:
Supported target platforms:
Supported target architectures:
Supported execution modes:
xcode-select --install
[!NOTE] Make sure you have accepted the Xcode license agreement:
bashsudo xcodebuild -license accept
To build CoreCLR runtime, libraries and tools, run the following command from <repo-root>:
./build.sh clr+clr.runtime+libs+packs -os <ios|iossimulator|tvos|tvossimulator|maccatalyst> -arch arm64 -cross -c <Release|Debug>
[!NOTE] The runtime packages will be located at:
<repo-root>/artifacts/packages/<configuration>/Shipping/
To demonstrate building and running an iOS application with CoreCLR, we will use the HelloiOS sample app.
A prerequisite for building and running samples locally is to have CoreCLR successfully built for the desired iOS platform.
To build HelloiOS, run the following command from <repo-root>:
./dotnet.sh build src/mono/sample/iOS/Program.csproj -c <Release|Debug> /p:TargetOS=<ios|iossimulator|tvossimulator|maccatalyst> /p:TargetArchitecture=arm64 /p:UseMonoRuntime=false
On successful execution, the command will output the iOS app bundle.
To run the sample, run the following command from <repo-root>:
./dotnet.sh publish src/mono/sample/iOS/Program.csproj -c <Release|Debug> /p:TargetOS=<ios|iossimulator|tvossimulator|maccatalyst> /p:TargetArchitecture=arm64 /p:DeployAndRun=true /p:UseMonoRuntime=false
The command also produces an Xcode project that can be opened for debugging:
open ./src/mono/sample/iOS/bin/<ios|iossimulator|tvossimulator|maccatalyst>-arm64/Bundle/HelloiOS/HelloiOS.xcodeproj
[!NOTE] Make sure you have a simulator available. You can list available simulators with:
bashxcrun simctl list devices
To build the runtime tests for iOS with CoreCLR, run the following command from <repo-root>:
./src/tests/build.sh -os <ios|iossimulator|tvossimulator|maccatalyst> arm64 <Release|Debug> -p:UseMonoRuntime=false
Native debugging is supported through Xcode. You can debug both the managed portion of the sample app and the native CoreCLR runtime.
HelloiOS sample app.open ./src/mono/sample/iOS/bin/<target>/Bundle/HelloiOS/HelloiOS.xcodeproj
[!NOTE] For debugging native CoreCLR code, you may need to build with debug symbols.