title: Xamarin cannot build to device - Tool exited with code: 1. Output: error: The specified item could not be found in the keychain
body: <p>I am trying to build an iOS app in Debug|iPhone configuration on Xamarin Mac, but I am getting:</p>
  
  <p><code>/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.</code></p>
  
  <p>This all started when I had to reset my default keychain and lost my certificates.  I've tried fixing it by:</p>
  
  <ul>
  <li>Creating a new certificate manually (ensuring I had "Apple Worldwide Developer Relations Certification Authority" when requesting the certificate from the certificate authority as suggested <a href="https://stackoverflow.com/a/19160225/2301021">here</a>)</li>
  <li>Creating a certificate using xcode 8.3.1 (exporting this certificate onto another machine lets me build fine on that machine)</li>
  <li>Importing my certificates from my old keychain (each time I created a new certificate I ensured to update and download the provisioning profile)</li>
  <li>exporting a working certificate from another user on another machine and importing it onto my machine</li>
  <li>uninstalling Xamarin studio, deleting the folders mentioned <a href="https://developer.xamarin.com/guides/cross-platform/getting_started/installation/uninstalling_xamarin/#Uninstall_Xamarin_Studio" rel="nofollow noreferrer">here</a>, and installing Xamarin Studio 6.1.3 + Xamarin.iOS 10.4.0.123 (was using  6.1.3 + 10.2.1.5 previously)</li>
  <li>uninstalling Xcode 8.1 and installing Xcode 8.3.1</li>
  <li>installing visual studio for mac (this gave me a different error "EnsureBindingRedirects task failed unexpectedly" - likely a separate bug)</li>
  </ul>
  
  <p>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. </p>
  
  <p>Any help on this would be greatly appreciated.</p>