1

I am trying to build an iOS app in Debug|iPhone configuration on Xamarin Mac, but I am getting:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: Tool exited with code: 1. Output: error: The specified item could not be found in the keychain.

This all started when I had to reset my default keychain and lost my certificates. I've tried fixing it by:

  • Creating a new certificate manually (ensuring I had "Apple Worldwide Developer Relations Certification Authority" when requesting the certificate from the certificate authority as suggested here)
  • Creating a certificate using xcode 8.3.1 (exporting this certificate onto another machine lets me build fine on that machine)
  • Importing my certificates from my old keychain (each time I created a new certificate I ensured to update and download the provisioning profile)
  • exporting a working certificate from another user on another machine and importing it onto my machine
  • uninstalling Xamarin studio, deleting the folders mentioned here, and installing Xamarin Studio 6.1.3 + Xamarin.iOS 10.4.0.123 (was using 6.1.3 + 10.2.1.5 previously)
  • uninstalling Xcode 8.1 and installing Xcode 8.3.1
  • installing visual studio for mac (this gave me a different error "EnsureBindingRedirects task failed unexpectedly" - likely a separate bug)

The fact it failed to build when using a known working certificate/provisioning profile combo on another machine leads me to think that Xamarin is having a problem finding the certificate when doing the build, even though it sees the certificate and provisioning profile in Project Options -> iOS Bundle Signing. There could also be an issue in the Keychain somewhere.

Any help on this would be greatly appreciated.

Community
  • 1
  • 1
Casey Hancock
  • 508
  • 6
  • 19

2 Answers2

2

I fixed this by doing the following:

  1. security dump-keychain -d login.keychain to list all the items in my keychain

  2. Noticed there was an extra certificate that was not showing up in Keychain Access

  3. Deleted this item using security delete-identity

  4. Did diskutil resetUserPermissions / $(id -u) and restarted my Mac

I'm not sure if steps 1-3 are necessary, so if you are having this issue I would try step 4 first and see if that works.

Casey Hancock
  • 508
  • 6
  • 19
0

I am using Visual Studio on a mac and my solution was to shut down Visual Studio and start it again after logging out of Apple Developer Account in the visual studio preferences.

Morten
  • 112
  • 2
  • 8