Updating Mobile Provisions Problem

Hi, I'm trying to update a mobile provision for an existing IPA file.


I wrote a bash file automates this process. Here's what the bash file looks like:


#!/bin/bash

unzip \*.ipa


for d in Payload/*.app ; do

rm -rf $d/_CodeSignature/

cp NewProvision.mobileprovision $d/embedded.mobileprovision

codesign -f -v -s "iPhone Distribution: Company LLC" $d

filename=$(basename $d)

filename=${filename%.*}

zip -qr $d.ipa $d

mv $d.ipa $filename.ipa

done


What this process does is that it unzips the ipa file, removes the _CodeSignature folded from the app folder, makes a copy of the new provision and overwrites it with the new one, performs a codesign recompresses the app into an ipa file and moves it to the root folder. The console returns the unzip process, and the following message:


Payload/APP.app: replacing existing signature

Payload/APP.app: signed app bundle with Mach-O universal (armv7 armv7s arm64) [com.company.App]


I verified that it is creating a new ipa from the app folder, that the _CodeSignature is removed and the mobileprovision was replaced.


However when I try to drag this onto my ipad using xCode in the device window, I get this message:

"App Installation failed

The application could not be verified"


I know that "iPhone Distribution: Company LLC" exists on my keychain and when I put the version with the old mobileprovision onto the iPad it works. I've spent hours searching for a solution and I haven't found anything that works. If someone could guide me in the right direction it would be greatly appreciated.


Thank you.

Updating Mobile Provisions Problem
 
 
Q