Xamarin Error after migrating macbook: No valid iOS code signing keys found in keychain
I was busy the last months with creating a Windows Universal App, and now it’s time to start with the iOS version using Xamarin. To get a bit more familiar with Xamarins iOS environment I’ve downloaded Xamarins sample app called Sport.
At first I got several error messages regarding missing types or namespaces. Fortunately you only need to wait a bit and Xamarin Studio automatically downloads all necessary libraries etc. But 1 error did not disappear:
/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. (Kalabo.iOS)
The proposed solutions were always the same, e.g. in Xamarin forum: Get the Dev certificate from Apple. So I started XCode and at Preferences -> Accounts I clicked the plus symbol in the lower left to add a new apple id. Everything worked fine, I downloaded the iOS development and iOS distribution signing identity. Then I went back to Xamarin, but still the same error.
Another proposal was to delete the entitlements.plist so I did this also even though it’s just an option. So this also did not fix it.
Fortunately the excellent Xamarin Support was able to help: You do not only need the public keys from the user certificate which are stored in the apple store. You also need the private keys which are only stored on the local machine. See also https://developer.xamarin.com/guides/ios/getting_started/installation/device_provisioning/#Understanding-Certificate-Key-Pairs for details. One option would be the recreation of the private keys, and the other would be the export from the old machine.
So the problem does not appear when you install the keys in XCode for the first time, because the private keys are automatically created. But when you move to a new machine this is an important step.
Details for exporting and importing your Developer Profile are supplied by Apple at https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html#//apple_ref/doc/uid/TP40012582-CH31-SW16
And now compiling the sample app works fine.