title: iOS xCode6 (Application signature not valid)
body: <p>This isn't the first time this has happened to me. Last time I resolved it purely by accident but that's no way to move forward. I've now lost 2 whole days on this and I have no hair left.
  So here's the problem. I have to re-sign an Enterprise Distributed app in order to release the latest update.
  I do this in terminal using the <code>codesign</code> function. All appears to be building correctly. No issues seen on the way through. When it comes to downloading the new app to my device, it fails and in the xCode device logs it tells me <code>(Application signature not valid)</code>.</p>
  
  <p>So i'm in a great mood at this point as I realise that i'm back in that place and that i may as well write off the rest of the week.</p>
  
  <p>So here's what i've done so far to remedy this.</p>
  
  <ul>
  <li>Removed all my related keys and certificates in keychain access</li>
  <li>Removed saved provisioning profiles from my device </li>
  <li>Revoked and destroyed all certificates in xCode and on the apple dev portal.   </li>
  <li>Refreshed from xcode to receive new developer and distribution<br>
  certificates.</li>
  <li>Created new certificate request files  </li>
  <li>Created a new app id under a new name </li>
  <li>Added push services using the new signing request</li>
  <li>Created a new provisioning profile with the new name and 
  using all the new valid certificates created earlier.</li>
  <li>Recreated all .plist files with the new information and code signed in terminal.</li>
  </ul>
  
  <p>No change.</p>
  
  <p>Private and public keys are all there. I've done everything mentioned in every walkthrough and answer i can find. I've been over this process so many times that i'm getting very good at it.. but it simply isn't working for me.</p>
  
  <p>The only thing i can guess as the problem is that my Certficate in keychain doesn't have a code next to the description. It might be nothing but it's all i can think of at the moment.  it says <code>iPhone Distribution: &lt;name&gt;</code> instead of <code>iPhone Distribution: &lt;name&gt; (&lt;teamcode&gt;)</code>. Doesn't seem to matter how I create the keys this doesn't seem to remedy this.</p>
  
  <p>If this is the case, If someone could point me to a detailed and up to date walkthrough of how to make this happen that would be a start.</p>
  
  <p>And if anyone has or knows of a definitive and up to date walkthrough of how to successfully create valid and working Enterprise distribution certificates, that would be solid gold. </p>
  
  <p>Here's my error log code just for fun</p>
  
  <pre><code>[MICodeSigningVerifier performValidationWithError:]: 186: Failed to verify code signature of &lt;MIExecutableBundle : path = /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.F1KrWm/extracted/Payload/&lt;myRebuiltApp&gt;.app identifier = com.&lt;company&gt;.&lt;app&gt; type = 4&gt; : 0xe8008019 (Application signature not valid)
  Mar 17 14:40:54 My-iPad installd[36] &lt;Error&gt;: 0x1d44000 -[MIInstaller performInstallationWithError:]: Verification stage failed
  Mar 17 14:40:55 My-iPad itunesstored[83] &lt;Error&gt;: 0x681000 __MobileInstallationInstallForLaunchServices_block_invoke240: Returned error Error Domain=MIInstallerErrorDomain Code=13 "Failed to verify code signature of &lt;MIExecutableBundle : path = /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.F1KrWm/extracted/Payload/&lt;myRebuiltApp&gt;.app identifier = com.&lt;company&gt;.&lt;app&gt; type = 4&gt; : 0xe8008019 (Application signature not valid)" UserInfo=0x16edcd10 {LibMISErrorNumber=-402620391, LegacyErrorString=ApplicationVerificationFailed, FunctionName=-[MICodeSigningVerifier performValidationWithError:], NSLocalizedDescription=Failed to verify code signature of &lt;MIExecutableBundle : path = /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.F1KrWm/extracted/Payload/&lt;myRebuiltApp&gt;.app identifier = com.&lt;company&gt;.&lt;app&gt; type = 4&gt; : 0xe8008019 (Application signature not valid), SourceFileLine=186}
  </code></pre>
  
  <p>Any help on this would be hugely appreciated.</p>