.NET MAUI unable to debug iOS on simulator or phone

5.8k Views Asked by At

I'm new to .NET MAUI and I'm experimenting with a MAUI Blazor App. However, I'm having no luck getting it to debug on iOS.

If I have my physical iPhone plugged into my windows machine or my mac on the local network, and try to debug with the local device, I just get this message:

No valid iOS code signing keys found in keychain

If I try to use iOS simulator it brings up a prompt to pair to the MAC. I've followed the guide to enable local sharing and configure the firewall. It seems to connect, I get the username and password prompt, but after some progress indication it halts with the following error:

An error occurred while trying to connect to the Broker... Probed locations for Mono on the Server: mono64, /Library/Frameworks/Mono.framework/Versions/Current/bin/mono64, /usr/bin/mono64, /bin/mono64, /usr/local/bin/mono64, /usr/sbin/mono64, /sbin/mono64, /Users/matthewpaul/Library/Caches/Xamarin/XMA/Runtimes/mono/bin/mono64, mono, /Library/Frameworks/Mono.framework/Versions/Current/bin/mono, /usr/bin/mono, /bin/mono, /usr/local/bin/mono, /usr/sbin/mono, /sbin/mono, /Users/matthewpaul/Library/Caches/Xamarin/XMA/Runtimes/mono/bin/mono

Any pointers on how I might get either/both the local device and simulator working?

2

There are 2 best solutions below

0
On BEST ANSWER

If anyone gets the same issue on the iOS simulator, it was re-installing Visual Studio 2022 Preview on the Mac and selecting all mobile related workloads that got it working for me.

With running the application on a device, there's a guide. You need to add your Apple account to visual studio:

https://learn.microsoft.com/en-us/xamarin/cross-platform/macios/apple-account-management?tabs=windows

And enable automatic provisioning (if you've an Apple developer account)

https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/automatic-provisioning?tabs=windows

enter image description here

Or free provisioning if you don't:

https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning?tabs=macos

More general info here:

https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/

1
On

Visual studio has to be open on both sides and xcode too on Mac.

You have to use the same account on mac and on windows.

That's what I had to do to use the sim.

You can follow the same guide I did:

https://www.c-sharpcorner.com/article/pair-to-mac-m1-chip-from-windows-machine-for-maui-ios-development-using-visual-s/

Hope it helps!