Skip to main content

Looping iOS Remote Simulator Connection Issue with .NET MAUI

·3 mins

I ran into an issue the other day with the iOS Remote Simulator on Windows the other day while working on a .NET MAUI app. While deploying my app it kept looping with things like: Connecting to Mac…Checking Server…Connected… Coincidentally I landed on the Microsoft Docs page for it which showed me how to fix it, I thought I’d amplify that content a little!

What is the iOS Remote Simulator? #

The iOS Remote Simulator is basically a remote desktop session that reflects the iOS Simulator screen on Windows. The iOS Simulator is only available on Mac together with XCode, but if you connect a Mac to your network you can use this solution to show the Simulator alongside Visual Studio on your Windows machine.

More information on what it is and how to set it up can be found here: https://docs.microsoft.com/dotnet/maui/ios/remote-simulator

The Looping Issue #

As mentioned earlier: when you click the run button to start debugging your app, the iOS Remote Simulator screen will come up, but the little dialog will only show you a loop of messages that it’s trying to connect to your Mac, but it will never succeed.

The Fix! #

Luckily the fix isn’t anything too hard, but I stumbled on it by accident, so I thought I’d put it in a small blogpost so that it’s maybe a bit more discoverable.

Here are the steps to resolve it, you should do it on your Mac:

  1. Ensure that Xamarin Mac Agent (XMA) and Xcode aren’t running.

    I did make sure Xcode wasn’t running, not sure how I could check for the XMA, but it didn’t bother me in the process.

  2. Delete your ~/Library/Developer/CoreSimulator/Devices folder.

    I just found that folder and deleted all the subfolders in it. Note: ~ stands for your users profile folder. If your username is billg then the full path is /Users/billg/Library…

  3. Run killall -9 com.apple.CoreSimulator.CoreSimulatorService

    Open a Terminal window and run this command, it will kill a service that is running that handles iOS Simulators.

  4. Run xcrun simctl list devices

    In that same Terminal window run this command, it will list all the iOS Simulator images. This is probably done to restart the service we killed in step 3.

That’s it! I think I had to stop whatever I was doing on the Windows side and maybe reboot Visual Studio just to be sure, but after making sure I reset the whole state it started working again.

If you want to read the steps on the official Microsoft Docs page, please turn here: https://docs.microsoft.com/dotnet/maui/ios/remote-simulator#troubleshooting

Happy .NET MAUI developing!

PS. This probably works for Xamarin.Forms too 🤫