27
votes

I can Archive and Publish an app in debug mode, but when switched to App Mode i get the following error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com.

the attached file shows i do have the relevant Certificates but Xamarin keeps complaining

The app has been successfully published before but using a different profile on the same mac. Both users key chains contain the same certificates

enter image description here

enter image description here

7
It looks like you have two distribution certificates. Log into the Apple Developer profile and find out which one is the right one and delete the other. Having more than one can confuse the codesign program. - trojanfoe
tried removing both and then adding individually - xamarin still complained the error - amun1000
Did you delete the old ones from the keychain too? - trojanfoe
Silly thought I know but...did you quit and restart Xamarin Studio after changing around certs and profiles? I find that to be necessary even after updating an existing cert. - DennisWelu
yeah quitted and restarted Xamarin. I deleted one iphone dist cert (with one remaining) from the keychain - restarted xamarin. Then retried with the other cert - same process. Same result. I only deleted the certs is there any thing else i should delete. My profile on the apple developer site has both certs in there - amun1000

7 Answers

29
votes

I resolved that changing plataform build configuration from iPhone to iPhoneSimulator.

enter image description here

3
votes

got it work in the end by remving all the certificates and then putting them back in the Key chain

3
votes

I get this error when I open Xamarin University Exercises with Visual Studio 2015. A bug was entered and they decided that it is expected behavior. Xamarin Bug

If you work in Xamarin Studio and set this property for whatever reason, then open it in VS, you may hit this issue with no way to edit / remove the Entitlement setting in the Project Properties.

I guess the Exercises are created with Xamarin Studio.

The accepted workaround is to open the iOS .csproj and manually edit the <CodesignEntitlements></CodesignEntitlements> for the Debug|iPhone PropertyGroup.

Bug workaround enter image description here

1
votes

I struggled too for the last day to make Xamarin (now Visual Studio for Mac) successfully deploy on my device with the free developer signing (since I'm new in this area and I'm not ready yet to join the developer program yet), and what helped was to first deploy a dummy app with the same bundle identifier from XCode like others suggested on different sources, keep CodesignEntitlements as it is in the .csproj file, but replace CodesignKey's value iPhone Developer like in the answer here: https://stackguides.com/questions/58062268/no-valid-ios-code-signing-keys-found-in-keychain-you-need-to-request-a-codesign#=

Hope this will help somebody in the future like it helped me!

1
votes

Sometimes that happens when you newly start your computer and Visual Studio. Just don't hit green triangle debug Combobox-button and check what is selected in this combobox. If it is "Device" as in picture 1 select a simulator from the list as in picture 2 and start debugging. Else you get this error since VS will try to start debugging in a real device if "Device" selected in the combobox.

picture 1 picture 2

0
votes

you can try either of this

  1. remove any keys, if existing form Entitlements.plist .
  2. Change the proj run mode to debug , select device .
0
votes

I needed to create Signing Identity certificate from scratch and recreate Provisioning Profiles (on apple developer site). Then download using xcode.