Issues related to iOS/Mac Catalyst projects

Developing on older Mac hardware

The latest macOS release and Xcode version are required to develop with Uno Platform for iOS and Mac Catalyst. However, if you have an older Mac that does not support the latest macOS release, you can use a third-party tool to upgrade it such as OpenCore Legacy Patcher. While not ideal, this can extend the use of older hardware by installing the latest macOS release on it. Please note that this method is not required when developing for other targets such as Android, Skia, WebAssembly, or Windows.

Don't know how to marshal a return value of type 'System.IntPtr'

This issue may happen for Uno.UI 4.4.20 and later when deploying an application using the iOS Simulator or Mac Catalyst when the application contains a TextBox.

In order to fix this, add the following to your csproj (Xamarin, net6.0-ios, net6.0-maccatalyst):

<PropertyGroup>
  <MtouchExtraArgs>$(MtouchExtraArgs) --registrar=static</MtouchExtraArgs>
</PropertyGroup>

Error while retrieving iOS device in VS code

When switching to an iOS debugging target in VS Code, you might encounter an error stating that the iOS device could not be retrieved. The error message may appear as follows:

[Info]: Project reload forced to switch to net8.0-ios | Debug
[Error] Could not retrieve ios devices within 10 seconds. Aborting...

To resolve this issue, download Xcodes. Inside Xcodes.app, select the correct version of Xcode and click the Make Active button to make it the default Xcode for your Mac. After completing this step, you can speed up the process and use the new default Xcode for simulators. On VS Code, open the Command Palette and select Developer: Reload Window. This should resolve the error when switching to an iOS debugging target in VS Code.