I have a problem with re-sign IPA files with PHP
this is my code:
<?php
/*
unzip app.ipa
rm -rf Payload/MyApp.app/_CodeSignature/
cp ~/Downloads/AdHoc.mobileprovision Payload/MyApp.app/embedded.mobileprovision
codesign -f -s "iPhone Distribution: Company Certificate" --resource-rules Payload/MyApp.app/ResourceRules.plist Payload/MyApp.app
zip -qr app-resigned.ipa Payload/
*/
if(file_exists('app.ipa')) {
rename('app.ipa', 'app.zip');
$zip = new ZipArchive;
$res = $zip->open('app.zip');
if ($res === TRUE) {
$zip->extractTo('C:/Users/abdul/Dropbox/127.0.0.1/ios');
$zip->close();
}
}
// remove _CodeSignature
if(file_exists('Payload/Gab.ai ObjC.app/_CodeSignature')) {
$dir = 'Payload/Gab.ai ObjC.app/_CodeSignature';
$it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it,
RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if ($file->isDir()){
rmdir($file->getRealPath());
} else {
unlink($file->getRealPath());
}
}
rmdir($dir);
}
unlink('Payload/Gab.ai ObjC.app/embedded.mobileprovision');
// copy mobileprovision file
copy('embedded.mobileprovision', 'Payload/Gab.ai ObjC.app/embedded.mobileprovision');
// i think there is a problem here!
exec('codesign -f -s "iPhone Distribution: ****" --resource-rules Payload/Gab.ai ObjC.app/ResourceRules.plist Payload/Gab.ai ObjC.app');
?>
i have the app.ipa, embedded.mobileprovision and my Distribution.
but i think the problem with exec while using codesign it dose not create _CodeSignature folder !!
i don't have any idea about that codesign.
is there any one can help me?