ipa重簽名的文章應(yīng)該比較多痰洒,但是涉及到內(nèi)嵌多個(gè)framework的簽名可能介紹的就比較少了叁温。
當(dāng)然缤剧,其實(shí)內(nèi)嵌framework的簽名其實(shí)也很簡(jiǎn)單,步驟如下:
- 導(dǎo)出entitlements.plist
- 對(duì)framework單獨(dú)簽名
- 對(duì)ipa簽名
準(zhǔn)備材料:
- p12 安裝到keychain
- certificate安裝到keychain
- mobileprovision缎除,為了方便操作严就,可放置在ipa同一目錄
- ipa 需要重簽名的ipa
簽名過程:
說明,如下過程中embedded為筆者項(xiàng)目特有器罐,通常項(xiàng)目無需包含梢为。
如果您還需要修改bundle identifier,那么請(qǐng)參考 plutil命令轰坊。
示例:
#!/bin/sh
# ResignScript.sh
#
#
# Created by W3Mobile Server on 6/1/2016.
# It needs *.mobileprovision and *.ipa file in same folder.
#
# unpackage
echo "0. read paramter"
#theVersion=""
#
#if [ $# -ge 1 ]; then
# theVersion=$1
#else
# echo "Please set version as first paramter"
# exit
#fi
resignRoot=$PWD
certfierName="iPhone Distribution: Huawei Technologies Co., Ltd."
appFolder=""
echo "1. unpackage ipa"
rm -rf ./Payload
rm -rf resigned.ipa
unzip *.ipa >> resign.log
# search app floder
for app_item in ./Payload/*.app
do
if test -d $app_item
then
appFolder=$app_item
fi
done
if [ ${appFolder}x != "x" ]; then
echo "Did found app:"$appFolder
else
echo "No ipa found."
rm -rf resign.log
exit
fi
# copy embedded.mobileprovision
echo "2. copy embedded.mobileprovision"
rm -rf ${appFolder}/embedded.mobileprovision
cp ./*.mobileprovision ${appFolder}/embedded.mobileprovision
cd ${appFolder}/Embedded/
for zip_item in *.zip
do
unzip -q $zip_item
rm -rf $zip_item
done
cd $resignRoot
for bundle_item in ${appFolder}/Embedded/*.framework
do
if test -d $bundle_item
then
cp ./*.mobileprovision ${bundle_item}/embedded.mobileprovision
fi
done
echo "3. export entitlements.plist"
rm -rf ./entitlements.plist
codesign -d --entitlements=entitlements.plist ${appFolder}
echo "4. resign app"
rm -rf ${appFolder}/Embedded/Embedded.plist
cp ./Embedded.plist ${appFolder}/Embedded/Embedded.plist
cd ${appFolder}/Embedded/
for bundle_item in *.framework
do
if test -d $bundle_item
then
bunleName=${bundle_item%%.framework}
codesign -f -s "$certfierName" --entitlements=${resignRoot}/entitlements.plist ${bundle_item}
zip -q -r ${bunleName}.zip $bundle_item
rm -rf $bundle_item
fi
done
cd $resignRoot
for fmwk_item in ${appFolder}/Frameworks/*.framework
do
codesign -f -s "$certfierName" --entitlements=entitlements.plist ${fmwk_item}
done
codesign -f -s "$certfierName" --entitlements=entitlements.plist ${appFolder}
echo "5. package ipa ..."
zip -r resigned.ipa ./Payload/ >> resign.log
echo "6. clean ..."
rm -rf resign.log
rm -rf ./entitlements.plist
rm -rf ./Payload
echo "7. done."