title: Cannot install resigned .IPA (developer to enterprise account, Xcode7)
body: <p>I've got two apple developer accounts, one is a standard developer account (for distribution to the App Store), the other is an Enterprise account (for in-house distribution). </p>
  
  <p>I've also got a Continuous Integration service running on git commits that validates tests and distributes builds as necessary. The idea is to have it distribute to the App Store and at the same time upload an enterprise build to a Amazon AWS S3 bucket.</p>
  
  <p>In order to do this, I'm archiving the app using the developer account's signing certificate, bundle id and provisioning profile in order to upload the build to iTunesConnect. After this, I'm trying to resign the .IPA to use the bundle id, provisioning profile and code signing identity from the Enterprise account, using this shell script:</p>
  
  <pre><code>IPA=&lt;the original ipa path&gt;
  PROVISION=&lt;the provisioning profile&gt;
  CERTIFICATE=&lt;the name of the certificate to use in the keychain&gt;
  
  # unzip the ipa
  unzip -q "$IPA"
  
  # remove the signature
  rm -rf Payload/*.app/_CodeSignature Payload/*.app/CodeResources
  
  # change bundle id
  /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier &lt;the new bundle id&gt;" Payload/*.app/Info.plist
  
  # replace the provision
  cp "$PROVISION" Payload/*.app/embedded.mobileprovision
  
  # sign with the new certificate
  /usr/bin/codesign -f -s "$CERTIFICATE" Payload/*.app
  
  # zip it back up
  zip -qr resigned.ipa Payload
  </code></pre>
  
  <p>This script runs without any issues. However, if I try to install the build on my device I get the following error: "App installation failed: The application could not be verified."</p>
  
  <p>I cannot figure out what I'm missing. Any ideas?</p>
  
  <p>Thanks!</p>