title: codesign_allocate: file not in an order that can be processed (code signature data out of place)
body: <p>I have an iOS app ipa that I need to resign. After unziping the ipa and replacing the mobileprovisioning profile, I attempt to resign the app using the codesign command:</p>
  
  <pre><code>codesign -i "edu.eduname.appname" -f -s "iPhone Distribution: EDU University (XXXXXXXX)"  "Payload/Appname.app"
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>codesign_allocate: file not in an order that can be processed (code signature data out of place)
  </code></pre>
  
  <p>This is the full output:</p>
  
  <p>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/<strong>codesign_allocate: file not in an order that can be processed (code signature data out of place)</strong>: /build/Payload/Appname.app/Appname (for architecture armv7)
    Payload/Appname.app: the codesign_allocate helper tool cannot be found or used</p>
  
  <p>This is an existing app and this has worked several times in the past just a year ago the latest. It's built in Unity if that makes a difference. I tried to recreate it by building a sample Unity app but I was able to resign that with no problem.</p>
  
  <p>I'm using xcode 9.2. I also tried xcode 9.3 beta and 8.3 tools but I get the same error.  </p>