Can't Launch app on iOS Simulator in Xamarin Studio Mac - xamarin

Been tinkering with Hanselman.Forms on my Mac with Android. Today I decided it was time to try it on the iOS Simulator...
I have serious regrets about this decision.
I'm not sure what I'm doing wrong. I'm able to deploy an app from Xcode to the iOS Simulator just fine. Just won't work from Xamarin Studio.
In all fairness I do get an error:
No installed provisioning profiles match the installed iOS code signing keys.
I do see this "error" in Xcode as well, but it doesn't prevent me from launching the app there.
Thanks.

Removing entries from Entitlements.plist worked. I also had to delete the original device Xamarin Studio was trying to deploy to. After I did, Xamarin Studio created another device and launched the application successfully.
https://forums.xamarin.com/discussion/comment/117465#Comment_117465

To the exact error message:
No installed provisioning profiles match the installed iOS signing identities
control click Xamarin Studio > Solution > Project.iOS
Options > Build > iOS Bundle Signing > Custom Entitlements
Select and delete Entitlements.plist text entry. In other words, do not click on the ... button to select new new file, nor bother editing the entitlements by hand)
OK, Build > Rebuild All.

I ran into the same when I was trying to deploy to the simulator without a physical device configuration. My fix was to:
Close Visual Studio
Open the .csproj in NOTEPAD
Find the line with CodesignElements and delete it
Save the .csproj
Reopen the project in Visual Studio
Right-mouse your IOS project and click "Rebuild
All", you should see "2 Succeeded"
Give it a run, and your app will come up on your Mac
Good discussion of this here -
http://forums.xamarin.com/discussion/39534/cant-build-ios-in-xamarin-studio-5-7-1-through-5-9
Good luck

Related

The selected ios device is not supported for creating an archive

I'm trying to setup new MacBook as a build server remotely for xamarin projects. It is in my office and I connect there with rdp from Windows 10 from home.
On MacBook: installed Xcode, Apple Developer Tools, Transporter. On windows: connected to mac, entered AppleID in visual Studio, enabled Automatic Provisioning.
Then I build my Xamarin.Forms ios project in "AppStore" configuration and it's ok.
Then I click "Archive" on that project and get error message from Visual Studio Archive Manager:
Selected device doesn't support archiving.
The selected ios device is not supported for creating an archive.
Please select a remote device from the drop-down menu before archiving.
Do I have to have iPhone to build my app? Where - in MacBook location or at home?
Archiving of a new default project works in Xcode (the active scheme is set to "Any iOS device (arm64)"). The error is in visual studio.
Visual Studio 2019 - (16.11.2)
XCode 12.5.1
There is a new version that fixes this
It seems that remote device option does not show in drop menu in VS 16.11 .
Check the similar cases : here and here .
Try to downgrade Visual studio to 16.10.x to see if problem persists.
You can download the older version from this link .
You don't need a physical device to archive. Just click the bar on the top-left of your screen, then select the Any iOS Device option. On older versions of Xcode, I think it was called Generic iOS Device. After this, hit Product -> Archive again.
It looks like Microsoft have finally released a fix for this in 16.11.3: The release notes are here:
https://learn.microsoft.com/en-us/visualstudio/releases/2019/release-notes#16.11.3
The solution in 2022 is to choose "Remote Device" from the "Debug" dropdown:
This is hinted at in the question, but that error message no longer explains what to do (!?!)

Can't run a Xamarin App in iPhone Simulator from Visual Studio For Mac

In short: I am unable to run my app in the iPhone Simulator. There is no "Play button" (the triangle), only a Debugger button (hammer):
As you can see above I have "Generic Simulator". When I click on it, there is no list of various iPhones/iPads to choose from:
If I choose Android, I am able to run the app:
I have XCode installed. I ran XCode once.
I also installed the Command Line tools.
I created a new Xamarin Forms App:
Here are my iOS build options:
I am able to run the Simulator separately:
Creating an App in XCode and running in the Simulator works:
info.plist:
Prefrences -> SDK Locations -> Apple
Build -> Configurations:
Here is the kicker though. If I run a Xamarin App on my Windows machine using the iPhone Simulator on the Mac, it works!
What do I need to do so I can run my app inside the Simulator vis Visual Studio for Mac?
Few options you can worth to check. #WorldOfBasti suggested options plus following.
Configuration
Right click on the solution -> options -> Configurations -> Configuration manager -> ProjectName.iOS with Debug|iPhoneSimulator should be checked or if configuration "ProjectName.iOS with Debug|iPhoneSimulator" is not available then add this from General tab
Apple SDK path
Check Apple SDK path is set properly (Preference -> SDK Location -> Apple). It should have green tick mark with Xcode version and SDK path location.
Minimum system version (Deployment Target)
Change Deployment Target to minimum version (ie, lower than your simulator version)
Switch debug <-> release
Today I have also faced same issue which you are facing. I have switched debug to release, iOS to Android. Then reverted back to iOS and debug from the top device selection status bar. Then Simulator option was appearing. So, might be UI updated issue in Visual studio for mac. Please give a try.
I assume that you tried the basics things like restarting your Mac, etc. So here are a few things, that might solve your problem:
Check your build configurations, here is a good video
Close VS for Mac, start Xcode and create a test project which you run on a simulator. If it works try again in VS for Mac
Close VS for Mac, goto Xcode -> Preferences -> Accounts and download the manual profiles of your developer account. Try again in VS for Mac
Clean your project: In VS for Mac, goto Build -> Clean All. Then Close VS for Mac, goto your project folder and delete in "yourprojectname" and "yourprojectname".iOS all bin and obj folders. Try again
If all of this doesn't work, I would try to reinstall it (if you have any important projects, make a backup):
Uninstall VS for Mac and Xcode
Install Xcode again from the App Store
Install Visual Studio for Mac
Hopefully it works..
Looking at the Visual Studio for Mac logs, specifically the IDE log, I found this line ... 'The target name of simulated device could not be added because it's already cached'.
You are welcome to read through all of this ... but you may just want to go down to the Addendum 2 (final?) and see if that works for you ... it ends up being simpler and quicker than anything else I have found.
So, at first, I started clearing the cache with a 'xcrun simctl erase all' command from Terminal, and when I started Visual Studio for Mac I could run a Xamarin App, but launching the simulator took quite a bit of time.
So hare's something I found works that you might want to try ...
Close iOS Simulator on Mac (if any).
Close ALL copies of Visual Studio that are connected to the Mac ... either on the Mac itself or on another computer connected to the Mac (if any).
Start Visual Studio for Mac.
If you can't run a Xamarin App, Close Visual Studio for Mac.
Launch the Simulator manually (I have it in the Dock, so I just click it) ... wait for it to fully startup.
Now close the Simulator (from the Simulator menu).
Now restart Visual Studio for Mac.
If you still can't see the simulator devices to run on ... try the above steps one more time (this time you should only have to close Visual Studio for Mac followed by manually starting the Simulator, waiting for it to start, and then quitting the Simulator and finally restarting Visual Studio for Mac).
It still isn't great, but this has (so far) always worked for me. And the Simulator starts up substantially quicker then if I did a 'xcrun simctl erase all' command from Terminal.
Addendum: Most of the time the above works. But occasionally I still have to clear the cache from the Terminal with 'xcrun simctl erase all' command.
Also: I have also found (although maybe it's just my imagination) that clearing out the Visual Studio for Mac temporary .binlog files that are written in the 'T' folder will sometimes fix the problem (if you look at an IDE log from Visual Studio for Mac; right after the 'The target name of simulated device could not be added because it's already cached' message, you should see some .tmp files being created. The directory where they were created is the 'T' folder I'm talking about). I sometimes delete the tmp*.binlog and tmp*.tmp as a last ditch effort before using the 'xcrun simctl erase all' command to try to get back to where Visual Studio for Mac will see the iOS Simulator Devices.
Finally: This is really starting to feel like a bug in Visual Studio for Mac startup (or possibly during a iOS project load). The reason I say that is I can ALWAYS see the iOS Device list from Visual Studio for Windows (as long as I can connect to the Mac). In addition, I can leave Visual Studio for Mac running (even hidden) and test an app on the iOS Simulator from Windows, then, leaving the iOS Simulator Running on the Mac, run an App on Visual Studio for Mac. If there really were a 'caching issue' with the Simulator it seems to me I should have problems running anything on the Mac after using the iOS Simulator from Windows, but it always works. For now, I'm working on a single Xamarin Project on the Mac (and I don't use the Mac for anything else), So I just let Visual Studio for Mac 'open at login' (Dock setting) and automatically 'load previous solution on startup' (Visual Studio for Mac setting), hide Visual Studio for Mac (Dock Setting) and if I need it, Visual Studio for Mac is already loaded and able to see iOS Devices to run Apps on with a quick click on the Dock Icon.
Addendum 2 (final?): I have now found that if I just close a solution that I have open that shows 'Generic Simulator' and re-open it without exiting Visual Studio for Mac (sometimes I have to do it multiple times ... I think I've counted up to 5 times before it finally worked), it will start showing the device list and I can run the iOS app in the Simulator. I don't even have to close the Simulator if it's already running, which saves a bunch of time.
It still feels like a bug to me, I don't see why I would have to close/open a solution multiple times to get the iOS devices listed and be able to run an iOS app. What really gets me is if I reboot the Mac, don't open the Simulator and start Visual Studio for Mac, then open a solution, I still have to go through the close/re-open solution steps... sometimes more than once. The simulator is not set to auto start or anything like that. But, at least, it's getting simpler, and takes less time, to get to a point where I can run an iOS app.

Xamarin Forms iOS application always runs on simulator even if I choose a device

I ported my Xamarin Forms project from windows to Mac and I am trying to run it on a connected device which is added in the provisioning profile (provisioning profile and identity is setup accordingly in IOS Bundle Signing settings).
Whenever I try to run the App using Debug|iPhone > my Iphone:
It starts simulator runs on that instead of the device :
After stopping the build if I go back to Bundle Signing settings its changed back to simulator automatically:
I am using following setup:
Visual Studio 2017 Community on Mac 7.2 preview build 540.
XCode 8.3.3
Can anyone please help me with proper configuration to run the app on IPhone?
Many Thanks in advance :)
After hours of messing around I finally found the problem and solution.
In solution settings, iOS project (Debug-iPhone) configuration was mapped to (Debug|Simulator).
Simply changed it to Debug|iPhone and Its working fine now.

No valid iPhone code signing keys found in keychain error Xamarin even after deleted Entitlements.plist

I'm getting this error iPhone code signing keys found in keychain error Xamarin even after deleted Entitlements.plist when trying to build the HelloWorld_iPhone app using Xamarin Studios. I understand Its require while deploy on real device but I'm building and trying to run on a simulator and still causes this issue. Is this known issue?
Yeah it seems bug in Xamarin Studio It has work around that you must have AppleID just to login on XCode. Try following:
Create an Acount # Apple Dev (If you don't have)
Open XCode and Menu
Preferences > Accounts > Add AppleID (Just Created)
(source: apple.com)
Now go back to Xamarin Studio and try to build your application again on simulator.
Try to rebuild and issues gone!!
In my case, there was already apple id but I clicked on ManageCertificate
and then I added certificate by clicking on plus sign and its done.
Try to delete Entitlements.plist from iOS project and try to recompile project.

iOS 9.0, Xamarin Studio, "waiting for debugger to connect..."

I have been using Xamarin.iOS platform with iPad with iOS 8.3 simulator successfully until I have updated Xcode 7 with iOS 9.0. When I select the simulator and run it, it keeps showing
waiting for debugger to connect...
nothing comes out at the end. Any solution?
By the way, why I cannot able to see ios 8 simulator options in the Xamarin after I updated the Xcode?
Was having the same issue. Here is what helped me. Open up xcode go to Devices under Window menu. Select the simulator device you are trying to use. Right click and delete it. Then add it again, bottom left + button. Hope this helps.
To solve this issue, follow these steps:
Open XCode and go to Locations options under the Preferences menu
Xcode > Preferences > Locations
Check command line tools is selected. If not, select from the available list and close the window.
Try to debug the iOS app from Visual Studio again.
I am sorry to say that but it is because of trash in debug/obj folders, I think. You can simply clean and rebuild the project.
Make sure that you have added a provisioning profile to you project.
Info.plist -> Signing -> Automatic Provisioning -> Select yours
I had the same problem and it was solved with this.
For anyone not using an emulator but using an iOS physical device, try updating your software on the device to the latest version. Give Visual Studio a restart, clean, and then build.

Resources