Reputation: 303
I'm pretty new to xamarin, tried to run a sample application (IOS). But Visual Studio says: "Please select a valid device before running the application"
I know on the IOS toolbar, there should be option to select which device to simulate (list of supported IOS devices like iphone 6, 5s etc), but I don't get that.
EDIT: To be more precise, TARGET IOS Device not shown on IOS Tool bar
Upvotes: 25
Views: 29598
Reputation: 185
My issue was that I needed to log into my Apple developer account in XCode again. For some reason it was showing an error state in XCode>Preferences>Account
I logged into my account again then clicked the "download manual" button and now the devices show up in VS.
Upvotes: 0
Reputation: 151
If you're using the latest XCode version, be sure it's compatible with your Xamarin.iOS and Visual Studio. For me, XCode 13 came out a few days ago and wasn't compatible with the latest Visual Studio. You can download an older version of XCode at https://developer.apple.com/download/more/, just be sure to change visual studio to point to the downgraded version in Visual Studio > Preferences > SDK Locations > Apple
Upvotes: 2
Reputation: 5099
This has started helping me out a lot with VS for Mac when all other options have failed!
sudo xcode-select --switch /Applications/Xcode.app
Upvotes: 0
Reputation: 165
Once in a while I always used to have this issue and solves it by starting Xcode first and then opening VS after. But recently it became consistent after Xcode 12.5 update. So as a trial, I uninstalled VS and reinstalled and now this workaround also stopped working. It's very annoying and there is a bug already reported to Microsoft to fix this.
The solution that worked for me is to
Unfortunately, you always have to open your sample sln first (but no need to create new sln every time) whenever you want to open your solution. But it solves the problem.
Upvotes: 4
Reputation: 1232
Another possible cause: Mistakes in editing your iOS platform project's info.plist can cause this to happen.
Upvotes: 0
Reputation: 5876
OR If above steps do not work then try adding new build configuration as shown in following image by selecting iphoneSimulator.
Upvotes: 9
Reputation: 5860
I had a similar issue. However, I was able to resolve it by going to XCode>Preferences>Accounts>ViewDetails>Download all. This caused visual studio to now display my device IOS name in the dropdown menu.
Upvotes: 1
Reputation: 8404
I had the same problem a year back - please check the following:
I think for me it was outdated versions and a hickup in the software, after a reboot it worked.
Upvotes: 21
Reputation: 764
Are you sure that the device is connected to the right machine? When I have a VM open on my iMac, I get prompted for which machine I want to connect a device to.
Also make sure that you have Debug
and iPhone Simulator
selected.
Upvotes: -2