How to use Xamarin's IOS Remoting Simulator

2019-02-11 02:25发布

问题:

Apparently the new Xamarin iOS remoting simulator for Windows is available in the Xamarin Alpha channel for Visual Studio on Windows.

However, there seems to be no mechanism by which it will appear. There seems to be no buttons or options to show this new iOS simulator in Windows.

There is zero documentation online, or videos or forum answers relating to this

If anyone from Xamarin is following this tag, can you please elaborate.

Thanks

回答1:

iOS Simulator (for Windows)

Preview Installer:

Download the preview installer and install on your Windows computer.

http://download.xamarin.com/xamarin-simulator/Xamarin.Simulator.Installer.0.9.0.25.msi

To enable the remoted iOS Simulator:

Make sure Visual Studio has connected to your Mac at least once before starting the remoted iOS Simulator.

Go to Tools > Options > Xamarin > iOS Settings and tick the box for Remote Simulator to Windows:

https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/

Update - Troubleshooting:

  • Update Xamarin on both your Windows and Mac machines to the latest alpha version.

    ** Your Xamarin plugin for VisualStudio version should now be 4.2.021+

(Verified via Tools \ iOS \ Mac Agent Console)

gv Broker42021
Requesting version of client Broker42021...
Waiting for response...
Current version of client Broker42021: 4.2.0.21

  • Install the Xamarin Simulator on Windows (via the download link above)

Note: This will be installed to C:\Program Files (x86)\Xamarin\Simulator


  • On the Mac, Kill all the Xamarin agents running on your Mac:

    ps ax |grep Mono.framework

Note: When everything is running fine, you will have five (5) Mono processes running, one of which is the Xamarin.Simulator.Server.exe process:


/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Broker/4.2.0.21/Broker.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Agents/IDB/4.2.0.21/IDB.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Agents/Build/4.2.0.21/Build.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/XMA/Agents/Designer/4.2.0.21/Designer.exe
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Users/sushi/Library/Caches/Xamarin/Simulator/Server/Xamarin.Simulator.Server.exe

Buyer beware:

ps -ax |grep Mono.framework | cut -c 1-5 | xargs kill

  • On the Mac, kill all current sshd processes:

Note: This is assuming you are not doing this via an ssh connection ;-)

Buyer beware:

ps -ax |grep sshd | cut -c 1-5 | xargs kill

Note: You need to be root to do that, sudo su first


  • Over on Windows, kill ALL the Xamarin.Simulator running tasks

Note: We had a few Windows PC that had hundreds(!) of these running (?!!) (we just rebooted that machine), but found most of the ones failing to run/view the Simulator on Windows had 3-5 of these tasks running.


  • Since you killed all the agents on the Mac machine, Visual Studio/Xamarin will no longer be connected to the Mac, so re-connect.

Note: Make sure that you have Remote Simulator to Windows option already checked before reconnecting to the Mac build host.


  • F5 / Debug - Start Debugging your iOS project

  • Flip over to task manager and you should see one Xamarin.Simulator process running now:


  • After a second or two and some CPU usage spikes on that process and it should appear:


Tested on:

  • Parallels Desktop 11 / Business Edition (11.1.2+) ** Mac host / Windows Guest
  • Physical Windows and Mac machines

My Parallels setup that I use on all deployed Macs:

In the Parallels VM (Windows) configuration, add a second network adapter to the Windows guest that is assigned as a Host-Only and use that IP address as the Mac host for Xamarin connections, NOT the public, shared or bridged IP addresses.

Within Windows, disable the Firewall on this host-only adapter.

Do not use the bonjour/Window sharing Mac host name (XXXX.local), use the private IP address that is assigned to the host-only interface/network adapter. Add another Mac connection and enter the IP address, not the host name, and do not use one that Xamarin auto-adds to the list that includes the XXXX.local host name...

In the Mac, if using Little Snitch make sure that you have a rule that allows inbound connections from that Windows host-only IP address range to the launchd process (/sbin/launchd is the process that spawns the sshd processes)

Still not launching the Simulator?

Check your Mac Console:

If you see items like:

4/30/16 11:18:00.993 AM sshd[59748]: error: connect_to 127.0.0.1 port 52421: failed.

I would assume Little Snitch (or other Mac-based firewall) is blocking the reverse secure tunnel that Xamarin is creating. I do not know why this does not cause all the other Xamarin agents (build, designer, etc..) to also fail. Disable Little Snitch to confirm (kill all Xamarin agents and sshd processes and start over). If the remote Simulator works, review your Little Snitch/firewall rules, something is amiss.



回答2:

Remote simulating requires enterprise

https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/

Remoted iOS Simulator requires a Visual Studio Enterprise license


回答3:

Be aware that this is the first release and it is very much still a preview. If you have issues please do reach out via our forums [0], or whatever suits you best.

If you have the just-released alpha versions of everything and it doesn't work, we will need a copy of the log files (on both visual studio and the mac) to diagnose the root of the issue. Either the forums or bugzilla would be best for that.

[0] https://forums.xamarin.com/categories/visual-studio [1] https://bugzilla.xamarin.com/enter_bug.cgi?product=Windows%20iOS%20Simulator



回答4:

  1. Open simulator log to see what is the root cause. %LOCALAPPDATA%\Xamarin\Logs
  2. My log show this error
    System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.
  3. To fix the problem, I delete everything in %localappdata%\Xamarin\MonoTouch
  4. Disconnect the mac, forget it as well
  5. Re-connect Mac
  6. Itshould work now