如果你想把一个ipa文件安装到自己的iPhone上(别人发你的或者从第三方商店下载的…)你的手机如果没有越狱是无法正常安装的(排除企业证书分发),但是 我们可以通过为ipa重签名实现,原理是将我们自己的证书打进ipa。
现在我们开始来进行重签名。
👉前提:要有自己的开发者账号。
第一步:用Xcode新建一个工程,Bundle identifier不要和手机中已有的的APP重复,然后用自己的证书打包出ipa文件。
第二步:获取mobileprovision文件。
先将一中(用自己证书打包的)ipa包进行解压。选中ipa包,右键 -> 打开方式 -> 解压,如下图所示:


以下第三、四、五步中如果之前已经安装过可以跳过
第三步:安装Homebrew
在终端先后执行下面2命令行安装,等待进度完毕
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
第四步:安装ruby
在终端执行下面命令安装ruby,等待进度完毕(输完密码可能在较短时间无反应)
brew install ruby
第五步:安装sigh脚本
执行下面安装命令
sudo gem install sigh
若出现以下报错
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/rougify
则安装命令修改为
sudo gem install -n /usr/local/bin sigh
第六步:使用sigh脚本开始重新签名
1、在终端输入sigh resign
,回车
2、把要签名的ipa文件(路径、包名不要有中文)拖到终端窗口上,回车
3、填写用来签名的证书(第一步中的证书)名如图(钥匙串中的完整名字),回车

4、把项目的配置文件.mobileprovision文件(第二步中的文件)拖到终端窗口上,回车
5、好了,resign脚本会自动更改bundel id,签名并重新打包。
完成后提示Successfully signed,新生成的包会自动替换原有文件。
第七步:安装重签名后的ipa文件
最新的iTunes已经不能给iPhone安装APP了,所以我们可以使用各种助手或者iTools进行安装。
网友评论
提示: Couldn't find signing identity ''.
我命名直接全部拖进去了 还是未找到
2.如果应用有多个targetes无法用上述方式重签名
还有Xcode 可以吧ipa 包安装到手机的
We identified one or more issues with a recent delivery for your app, "xxxx00". Please correct the following issues, then upload again.
Invalid Swift Support - The file libswiftAVFoundation.dylib doesn’t have the correct code signature. Make sure you’re using the correct signature, rebuild your app using the current public (GM) version of Xcode, and resubmit it. Don’t just modify the code signature of libswiftAVFoundation.dylib.
Best regards,
The App Store Team
5、好了,resign脚本会自动更改bundel id,签名并重新打包。
提示:
/usr/local/lib/ruby/gems/2.5.0/gems/fastlane-2.87.0/fastlane_core/lib/fastlane_core/ui/interface.rb:133:in `user_error!': Provisioning profile file could not be found or is not a .mobileprovision file (CA110109BB00BC293FD6D9E433AEBAA7886191AC/Users/qianyou/Desktop/yujianxy.mobileprovision) (FastlaneCore::Interface::FastlaneError)