user2209634
user2209634

Reputation: 649

Unable to run on iOS Simulator from Visual Studio on Windows

The Issue

Developing on Windows with Visual Studio, and trying to run my app in iOS Simulator.

I'm not fussy whether the Simulator runs locally on my Windows machine, or on the Mac itself.

The Mac is "connected" from within Visual Studio, and Visual Studio successfully installed any missing libraries it required remotely on the Mac.

My app runs wonderfully on Android in both the Android simulator and physical devices.

But I'm unable to get the iOS Simulator to run when launched from Visual Studio.

Environment

Windows machine:

Mac

Different Scenarios Tried

Scenario 1 - Enabled Remote Simulator to Windows

  1. Visual Studio → Options → Xamarin → iOS Settings → Simulator - Checked "Remote Simulator to Windows".
  2. Selected "iPhoneSimulator".
  3. Selected iOS project from solution "BlazorHybridApp.iOS".
  4. Selected from the list of available devices "iPod touch (7th generation) iOS 14.5)".
  5. Clicked "Run".

enter image description here

Scenario 1 - Result within Visual Studio on Windows

enter image description here

Scenario 2 - Disabled Remote Simulator to Windows

  1. Visual Studio → Options → Xamarin → iOS Settings → Simulator - UNCHECKED "Remote Simulator to Windows".
  2. Selected "iPhoneSimulator".
  3. Selected iOS project from solution "BlazorHybridApp.iOS".
  4. Selected from the list of available devices "iPod touch (7th generation) iOS 14.5)".
  5. Clicked "Run".

Scenario 2 - Result within Visual Studio on Windows

Error message:

error MT0069: The app directory '/Users/macbook/Library/Caches/Xamarin/mtbs/builds/BlazorHybridApp.iOS/373192a984aab952b21bd389276fc38f881a1f70c8927669096f762b8fab1f51/bin/iPhoneSimulator/Debug/BlazorHybridApp.iOS.app' does not exist.

I checked on the MacBook, and indeed the folder does not exist (I'd expect it to be auto-created as part of the build?).

So, I manually created the folder on the Mac, and reran from Visual Studio with the same settings selected.

Scenario 2 - 2nd Result within Visual Studio on Windows

Error message:

error MT1008: Failed to launch the simulator: Could not find required file '/Users/macbook/Library/Caches/Xamarin/mtbs/builds/BlazorHybridApp.iOS/373192a984aab952b21bd389276fc38f881a1f70c8927669096f762b8fab1f51/bin/iPhoneSimulator/Debug/BlazorHybridApp.iOS.app/Info.plist'.

I checked on the MacBook, and the specified file does not exist. In fact the folder I manually created is empty. I'm assuming this is where Xcode should be generating the binaries, etc.?

Despite the error message, on the MacBook, the Simulator DID launch, but did not launch my app.

Other Info

Big Sur/Xcode newly installed

This is a virgin MacBook, so no configuration changes have been made to the OS or Xcode.

Confirmed Simulator is working on MacBook

I have checked that the Simulator is working ok on the MacBook, by creating a new App project on the MacBook from within Xcode and running it on the Simulator.

Even tried Visual Studio 2022

Out of desperation, I have also tried downloading Visual Studio 2022 Preview which also has the required mobile dev support, but got the same issues.

Any ideas?

Can anyone offer any advice? Would be very gratefully received.

Upvotes: 1

Views: 5895

Answers (1)

ColeX
ColeX

Reputation: 14475

For Scenario 1, it is a known issue and it has been reported here .

According to the latest reply , there will be a release for this issue soon .

For Scenario 2 , I would suggest you

  1. Update everything to the latest stable version (vs for windows , vs for mac , Xcode).

  2. Delete bin and obj folders in Forms and iOS project , rebuild and try again .

  3. If problem persists try to create a new project and test .

Upvotes: 2

Related Questions