如题,最近用到了,记录一下。
使用 sigh resign 重签名的时候,看情况修改或不修改包名;
修改gem的镜像源,如果还没改的话
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.com
# 确保只有 gems.ruby-china.com
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果安装提示无法连接到 https://raw.githubusercontent.com/Homebrew/install/master/install
使用 https://itqiankun.oss-cn-beijing.aliyuncs.com/others/brew_install.rb 替代,
来源这里
brew install ruby
sudo gem install sigh
#或者
gem install sigh
做重签名的,一般都是重签成企业包居多。
准备好分发证书并安装(带密钥的p12);
如果要修改包名的,要生成新的 Identifier 和 对应的 provisoning profile ;
如果不需要改包名,则这步可不做,直接找个现成的 provisoning profile ;
将描述文件修改名称为 embedded.mobileprovision。
改包名要考虑APP有没有什么地方用到包名校验,比如接入微信SDK,修改包名将导致拉不起微信支付和微信登录;
将 IPA文件和embedded.mobileprovision 放在同一目录下;
这个步骤比较简单;
MacMini:ipa重签名 dev$ sigh resign
....
[10:53:30]: Available identities:
iPhone Distribution: XXX Co., Ltd
AAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
iPhone Developer: XXX
BBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
iPhone Developer: XXX
CCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# 输入证书的 Signing Identity
[10:53:30]: Signing Identity: AAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
....
# 签名成功
[10:53:39]: Successfully signed /Users/dev/Downloads/ipa重签名/test.ipa!
security cms -D -i embedded.mobileprovision > embedded.plist
/usr/libexec/PlistBuddy -x -c 'Print:Entitlements' embedded.plist > entitlements.plist
entitlements.plist 长得大概这样,也可以直接复制修改,这里的包名不影响重签名出来的包名;
<plist version="1.0">
<dict>
<key>application-identifierkey>
<string>xxxxx.com.test.abcdstring>
<key>com.apple.developer.team-identifierkey>
<string>xxxxxstring>
<key>get-task-allowkey>
<false/>
<key>keychain-access-groupskey>
<array>
<string>xxxxx.*string>
array>
dict>
plist>
unzip test.ipa
rm -rf Payload/解压出来的.app/_CodeSignature/
rm -rf Payload/Your.app/Frameworks/xxxx.framework/_CodeSignature/
codesign -f -s "iPhone Distribution: XXX" Payload/解压出来的.app/Frameworks/xxxx.framework/
cp embedded.mobileprovision Payload/解压出来的.app/embedded.mobileprovision
codesign -f -s "iPhone Distribution: XXX" --no-strict --entitlements=entitlements.plist Payload/解压出来的.app
重签名完,可以查看信息对不对
MacMini:ipa重签名 dev$ codesign -vv -d Payload/解压出来的.app
Executable=/Users/dev/Downloads/ipa重签名/Payload/解压出来的.app/解压出来的
Identifier=ipa原包名
Format=app bundle with Mach-O universal (armv7 arm64)
CodeDirectory v=20400 size=83860 flags=0x0(none) hashes=2612+5 location=embedded
Signature size=4790
Authority=iPhone Distribution: 重签名的证书
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=Jun 14, 2019 at 4:13:03 PM
Info.plist entries=41
TeamIdentifier=重签名的证书标识
Sealed Resources=none
Internal requirements count=1 size=176
zip -r 已重签名.ipa Payload
https://gems.ruby-china.com/
https://blog.csdn.net/chqj_163/article/details/84792193
https://www.jianshu.com/p/b25dad435879
https://www.jianshu.com/p/52deb349d5d1
END