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:
Windows 10
Visual Studio 2019 Preview 16.11.0 Preview 3
Xamarin Mobile Blazor Bindings (doesn't to seem to be relevant, as I've tried creating other brand new iOS-related projects from within VS, with the same result).
Mac
MacBook Air, running Big Sur.
Xamarin.iOS14.20.0.24
Xcode 12.5.1
Simulator 12.5.1
Different Scenarios Tried
Scenario 1 - Enabled Remote Simulator to Windows
Visual Studio → Options → Xamarin → iOS Settings → Simulator - Checked "Remote Simulator to Windows".
Selected "iPhoneSimulator".
Selected iOS project from solution "BlazorHybridApp.iOS".
Selected from the list of available devices "iPod touch (7th generation) iOS 14.5)".
Clicked "Run".
Scenario 1 - Result within Visual Studio on Windows
Scenario 2 - Disabled Remote Simulator to Windows
Visual Studio → Options → Xamarin → iOS Settings → Simulator - UNCHECKED "Remote Simulator to Windows".
Selected "iPhoneSimulator".
Selected iOS project from solution "BlazorHybridApp.iOS".
Selected from the list of available devices "iPod touch (7th generation) iOS 14.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.
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
Update everything to the latest stable version (vs for windows , vs for mac , Xcode).
Delete bin and obj folders in Forms and iOS project , rebuild and try again .
If problem persists try to create a new project and test .
Related
I use Visual Studio 2022 on Windows for Xamarin development for Android & iOS. I use a Mac Mini with M1 for the iOS builds. All has been working fine for over a month. A few days ago I allowed the MAC to perform an update. Today when I tried to build for iOS, the Pair To Mac dialog said there was a monoframework mismatch and offered to install monoframework 6.12.0.174 on the MAC. Initially I chose Cancel,and then rebooted both machines. The same error occurred when I tried again. This time I allowed the install. After the install completed, every time I try to use the iOS Simulator it hangs as soon as it appears. I would appreciate some direction. I do not know how to fix it and I do not know how to back-out the mono install on the MAC. Please help.
Solution: I updated Visual Studio & Visual Studio for Mac to the current versions. Then found in the following in the Visual Studio ReleaseNotes:
Known Issues
Deploying an iOS app with Visual Studio 2022 and Apple Xcode 13.3 results in a Remote iOS simulator window with a blank/black screen. Workaround: Disable the “Remote Simulator to Windows” check box in the iOS Settings under the Tools - Options menu. The iOS app should deploy correctly on the macOS host.
Following those instructions I disabled the “Remote Simulator to Windows” check box in the iOS Settings under the Tools - Options menu. The iOS app then deployed correctly, but on the macOS host, no longer can it deploy on the Windows machine from the Mac build host as in prior versions.
I am having trouble with the iOS simulator and I was wondering if anyone else had the same problem or had any suggestions. I am very new to Xamarin; I just completed the Hello, World tutorial for iOS. I was able to build all with no errors. When I attempt to launch the app in the simulator, it displays a black screen.
I'm using an iMac running Parallels with Windows 10 and Visual Studio Enterprise 2017. I created a new Mobile App (Xamarin.Forms) project under Cross-Platform. Using the latest XCODE (v 12.0) in iMac to get the simulators.
Main Interface in Info.plist is set to "(not set)". I tried changing it to LaunchScreen but still get the black screen.
I created a hello world project in xcode and it works fine. Black screen issue is on Windows side. Let me know what I'm doing wrong. Thanks.
If you need to run iOS 14, you will need a Visual Studio 2019 in PC.
Run Xcode 12 – Run Xcode 12 before updating and running Visual Studio for Mac or Visual Studio 2019, as it installs some tools that Xamarin requires.
And the Visual Stuido 2017 supports the last version is iOS 12.
Run Xcode 10 – Run Xcode 10 before updating and running Visual Studio for Mac or Visual Studio 2017, as it installs some tools that Xamarin requires.
I've got everything seemingly working properly with the connection between my VS 2017 and the Mac. All looks good as far as the connection, the build works fine with no errors but I can't actually debug/run it because it doesn't allow me to choose a simulator.
On the toolbar, I have selected: Debug | iPhoneSimulator | Simulator
iPhoneSimulator is the ACTIVE platform.
On the Start > button when I drop down the menu options, it gives me:
Start
Device
Unsupported Devices >
Change Deployment Target
iPhone 5s iOS 10.2
iPhone 6 Plus 10.2
iPhone 6s Plus iOS 10.2
iPhone 6 iOS 10.2
See the screenshot of my menu options
and about 10 or so more but they are all in the "unsupported" category so whenever I try to click on one, nothing happens, and when I try to run my project, I get "Please select a valid device before running the application."
The PC is running Windows 10 x64 with Visual Studio 2017 Community Edition.
The MAC is running El Capitan 10.11.6. (Can't update to Sierra (10.12+) because Apple doesn't support it on this MAC)
Xcode running is 8.2 (have also tried 8.2.1) and can't update to 8.3+ because 8.3 and up requires Sierra (o/s 10.12+)
The latest versions of Xamarin are installed on both the PC and the MAC with all corresponding updates.
I've had to change the build option "Link Behavior" in VS to "Link Framework SDK Only" as the instructions state because of the fact that I can't install Xcode 8.3 on the MAC.
Any suggestions as to why everything would seem to work EXCEPT for VS 2017 no obtaining a list of simulators from the MAC? The MAC sees the simulators. Even running the command "xcrun instruments -s devices" on the MAC returns all of the simulators. I can make a sample program in Xcode, choose a simulator and run it. It just won't pass that information to my VS 2017 so that I can launch it from there. It will even let me launch the iOS simulator from VS 2017 without error.
I've tried uninstalling and re-installing Xamarin on both the PC and MAC and creating a new iOS project. Everything builds fine. Everything else works, just not the debugging/running and the reason it won't work is because I can't choose an actual emulator.
You will need to make sure your target version is lower than your Simulator version.
Open Info.plist and select a version lower or equal to 10.2.
I ran into something similar while running VS2017 on Mac OS X. I was using multiple build configurations, and I had multiple Info.plist files. One of them (not even the one that should have been used for that build config) had two entries for CFBundleShortVersionString due to a bad git merge. I wouldn't have discovered that if I wasn't opening each of them to change the Deployment Target mentioned in #lowleetak's answer. After correcting that, I was able to debug to the simulator again.
So for other who run into this - check your Info.plist files.
I am getting the following error when trying to run Visual Studio/Xamarin built application on the IOS Simulator.
Launch failed. The app 'App2' could not be launched on 'iPhone 7 Plus iOS 10.1'. Please check the logs for more details.
"App2" was created using the Tab Template, and NO code changes after rolling the application.
Windows environment: Windows 10 w/Visual Studio 2015 update 2
Mac environment: IMac Sierra fully patched. XCode 8.1 (what ever is most up to date).
I have connected the mac remote and pc. I can launch the iPhone simulator on the mac from Visual studio on the PC.
I get the error when trying to run "App2". It compiles fine, just won't run on the simulator.
I've searched here, and similar results speak of VS Crashing. Mine doesn't crash, just presents the error. NOTE: There's nothing in any log I can find with details by the way.
Ideas? Thanks!
EDIT: Just loaded up Parallels on the IMac and ran Win 10/VStudio. I get the same error. Again, xamarin remote agent connected and I can start the simulator from the PC, i just can't deploy to it.
After all the research and help from those here it comes down to a bug with the current version of Xamarin. Options are to wait until a new stable build is on the Xamarin site or get builds off of GIT. I'm choosing to wait, as I've not had great luck working with interim builds.
Xamarin that downloads with the new VS 2017 fixes this bug.
I am trying to simulate an iOS app on my windows machine using visual studio 2015(Xamarin installed). My windows machine is connected to a mac agent. When I simulate the app in the windows machine the simulator opens in the mac. Can any one tell me how to simulate the app on my windows machine.
You can use the iOS remote simulator. To use this feature you must update Xamarin and turn on remote simulator in Tools->Options->Xamarin->iOS.
You still need a mac for this feature.
You can use VNC to remote into the mac to show the simulator. That is what Xamarin dev's do at Evolve.
Unfortunately, that is your only option at the moment.
To simulate the iOS application, you must need MAC machine. Using Windows machine with Xamarin Studio, you can develop iOS application. But to run it on device or simulator, you need Mac machine.
Look at these solutions to remotely see the mac window:
Apple Remote Desktop
TeamViewer !
Chrome Remote Desktop
VNC Client. Activate screen sharing:
To fix this problem please follow these steps assuming your windows machine is connected to a mac agent:
Download and install the "Remoted iOS Simulator (for Windows)":
https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/
Go to Tools -> Options -> Xamarin -> iOS Settings:
Tick the checkbox "Remote Simulator to Windows"
Click in Build -> Configuration Manager:
Find your iOS project in the list and make sure the Platform is "iPhoneSimulator"
In your solution explorer right click in your iOS project and go to "Properties":
In the tab "iOS Build" find the section "Linker Options" and select the Linker behavior to "Link all assemblies" and Save
In your solution explorer right click in your iOS project again and click "Clean" and after that click "Rebuild"
Set the Visual Studio to run in Debug Mode and select "iPhone 5s iOS 9.3" click in option to launch the iPhone Simulator.
I hope it helps.
Remote iOS simulator is only available on enterprise
https://developer.xamarin.com/guides/cross-platform/windows/ios-simulator/
Remoted iOS Simulator requires a Visual Studio Enterprise license