在iOS15.0及以上设备上,如出现超级签、企业签及内测包出现“此App的开发者需要更新App以在此iOS版本上正常工作”或无法安装问题,系苹果签名方式更新造成,可根据实际情况解决。
方案一
将对应Xcode工程转移到MacOS11及以上版本的机器进行重新构建出包。
方案二
在MacOS10.14及以上版本的机器上进行如下操作:
- 将原ipa文件后缀改为zip,解压。
- 执行codesign进行重签
codesign -s "iPhone Developer: XXX" -f --preserve-metadata --generate-entitlement-der */Payload/xxx.app
codesign -dvvvvv */Payload/xxx.app
其中"iPhone Developer: XXX"为对应的证书名称,*/Payload/xxx.app为解压后.app文件路径。
- 将Payload压缩,改后缀为.ipa,重新分发即可。
Shell脚本实现
#!/bin/bash
#Re-sign for iOS 15.0+
#$1: origin ipa file folder
#$2: Certification name
ipa_name=''
app_name=''
suffix_ipa='.ipa'
suffix_zip='.zip'
cd $1
dir=$(eval pwd)
rename(){
for file in $(ls $dir | grep .$1)
do
ipa_name=$(ls $file | cut -d. -f1)
mv $file ${ipa_name}$2
done
echo "🍀Rename ${ipa_name}$1 to ${ipa_name}$2 done..."
}
#Rename .ipa to .zip
rename $suffix_ipa $suffix_zip
#Unzip file
unzip -q $ipa_name.zip
rm $ipa_name.zip
echo "🍀Unzip ${ipa_name}$suffix_zip done..."
#Get app name
for file in $(ls $dir/Payload/)
do
if [ "${file##*.}" = "app" ]; then
app_name=${file%.*}
echo "🍀Get app name:$app_name"
fi
done
#Code sign
der_name=$2
codesign -s "$der_name" -f --preserve-metadata --generate-entitlement-der Payload/$app_name.app
codesign -dvvvvv Payload/$app_name.app
echo "🍀Re-sign done..."
#Zip
zip -q -r $ipa_name.zip Payload
rm -rf Payload
echo "🍀Zip done..."
#Rename .zip to .ipa
rename $suffix_zip $suffix_ipa
echo "☕️The ipa file supporting iOS 15.0+ have been generated"