title: Code Sign Error not finding team ID during Cordova build ios
body: <p>After reading through all of the previous posts on code sign errors, I have reached a cul-de-sac. While building a cordova project (version 4.3.0) with ios platform (version 3.8.0) and using a Bamboo server to do the continuous integration. I cannot get my app to sign the iOS app for the release. This is the order of my build tasks:</p>
  
  <ol>
  <li>unlock keychain (I've made sure that my iPhone Developer and Distribution certificates were valid and not expired. I've also made sure that there are no permission windows that pop up on the Bamboo server, e.g. asking permission to unlock keychain.)</li>
  <li>cordova platform remove ios (to clean the directory and start fresh)</li>
  <li>add plugins for ios</li>
  <li>cordova platform add ios</li>
  <li>cordova build ios --release --device (build release version for a device to eventually upload to app store)</li>
  <li>xcrun to embed the mobileprovision</li>
  </ol>
  
  <p>I then get this error when running #5 task above:</p>
  
  <pre><code>    === BUILD TARGET Abczyx OF PROJECT Abczyx WITH CONFIGURATION Release ===
      Check dependencies
      Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “(null)” were found.
      CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.1'
  
      The following build commands failed:
      Check dependencies
      (1 failure)
      Error code 65 for command: xcodebuild with args: -xcconfig,/usr/local/Bamboo/Abczyx/platforms/ios/cordova/build-debug.xcconfig,-project,Abczyx.xcodeproj,ARCHS=armv7 armv7s arm64,-target,Abczyx,-configuration,Release,-sdk,iphoneos,build,VALID_ARCHS=armv7 armv7s arm64,CONFIGURATION_BUILD_DIR=/usr/local/Bamboo/Abczyx/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/usr/local/Bamboo/Abczyx/platforms/ios/build/sharedpch
  
  ERROR building one of the platforms: Error: /usr/local/Bamboo/Abczyx/platforms/ios/cordova/build: Command failed with exit code 2
  </code></pre>
  
  <p>Here is my <code>build-release.xcconfig</code>:</p>
  
  <pre><code>   #include "build.xcconfig"
  
     CODE_SIGN_IDENTITY = iPhone Distribution
     CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Distribution
  
     #include "build-extras.xcconfig"
  </code></pre>
  
  <p>Here is my <code>build.xcconfig</code>:</p>
  
  <pre><code>   // Type of signing identity used for codesigning, resolves to first match of given type.
     // "iPhone Developer": Development builds (default, local only; iOS Development certificate) or "iPhone Distribution": Distribution builds (Adhoc/In-House/AppStore; iOS Distribution certificate)
    CODE_SIGN_IDENTITY = iPhone Developer
    CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
  
    // (CB-7872) Solution for XCode 6.1 signing errors related to resource envelope format deprecation 
    CODE_SIGN_RESOURCE_RULES_PATH = $(SDKROOT)/ResourceRules.plist
  </code></pre>
  
  <p>The Bamboo server is running Xcode 6.1.1 Build version 6A2008a on a OS X 10.9.4. And I clicked refresh for the xcode's preferences > Accounts > user > Signing identities and provisioning profiles screen.</p>
  
  <p>I'm using Xcode 6.2, Build version 6C131e on a OS X 10.9.4 mac book pro for my local machine and I still get this same error. However, one of the strange things is that on my local machine, I sometimes run <code>cordova build ios --device</code> without the <code>--release</code> flag and I'm able to build an .ipa in my platforms/ios/build/device folder that is signed for debug, but this doesn't work on the remote Bamboo server (although it worked once many days ago).</p>
  
  <p>I've studied the releasenotes for Cordova iOS v.3.8.0 here and found nothing helpful to try beyond CB-7872 <code>CODE_SIGN_RESOURCE_RULES_PATH = $(SDKROOT)/ResourceRules.plist</code>, which has already been fixed: <a href="https://github.com/apache/cordova-ios/blob/master/RELEASENOTES.md" rel="nofollow noreferrer">https://github.com/apache/cordova-ios/blob/master/RELEASENOTES.md</a></p>
  
  <p>I've verified that the Bamboo server contains the sdk iphoneos8.1 that it's checking.</p>
  
  <p>I've verified that profile provisions are up to date and no one else has worked on my repo.</p>
  
  <p>I've verified that my CODE_SIGN_IDENTITY is good with this post and script: <a href="https://stackoverflow.com/questions/13962341/xcode-fails-with-code-signing-error?rq=1">Xcode fails with &quot;Code Signing&quot; Error</a></p>
  
  <p>I've tried adding a delay after building but I'm failing the build step already before I can try this: <a href="https://stackoverflow.com/questions/19783931/failed-to-generate-release-build-of-cordova-ios-app?rq=1">Failed to generate release build of cordova ios app</a></p>
  
  <p>I've tried to look at removing the auto-complete/manage schemes feature but not sure this is just another rabbit hole to fall in: <a href="https://stackoverflow.com/questions/14368938/xcodebuild-says-does-not-contain-scheme">xcodebuild says does not contain scheme</a></p>
  
  <p>I've tried looking at the source here: <a href="https://github.com/apache/cordova-ios/blob/master/bin/templates/scripts/cordova/lib/build.js" rel="nofollow noreferrer">https://github.com/apache/cordova-ios/blob/master/bin/templates/scripts/cordova/lib/build.js</a> But I don't see anything obvious to confirm or test...</p>
  
  <p>Two questions:</p>
  
  <ol>
  <li><p>Why is there a "null" for teamID? How can I check where it's checking?</p></li>
  <li><p>What else am I missing? What else can I check? Specifically in the source of cordova build ios script?</p></li>
  </ol>