1.找到ipa 解压缩(我这里直接修改后缀名为zip解压缩)
2.删除插件和带有插件的.app包(例如Watch、plugins)
3.通过security find-identity -v -p codesigning 找到替换之后的证书
4.通过命令行cd到app中 找到framework
将里面的所有文件 通过 codesign -fs "Apple Development: chenjialin1016@foxmail.com (C2893S7GXH)" andromeda.framework 替换
5.新建工程并且能 真机调试 ,通过拖拽的方式找到描述文件
6.security cms -D -i embedded.mobileprovision命令行找到Entitlements(权限)
7.将上面的保存到一个plist中 取名字叫Entitlements.plist
8.将plist放到.app中
9.codesign -fs "Apple Development: xxxxxx@foxmail.com (C2893S7GXH)" --no-strict --entitlements=Entitlements.plist WeChat.app
10.将.app打包成ipa
拷贝下面的代码到脚本中,修改下面三处的文件路径即可
#!/bin/sh
#默认填入数据,不填可以不用管
appNameStr="替换为你app的包名,eg. Sky"
appOriginPathStr="替换为你app文件的绝对路径,eg. xxx/Sky.app"
appIconPathStr="图标文件绝对路径,eg. xxx/Icon.png"
if [ "$1" ]
then
appNameStr="$1"
fi
if [ "$2" ]
then
appOriginPathStr="$2"
fi
if [ "$3" ]
then
appIconPathStr="$3"
fi
appName=${appNameStr}
appDetailName=${appName}".app"
appPayloadName=${appName}"/Payload"
appCopyToPayloadPath=${appPayloadName}"/"${appDetailName}
appOriginPath=${appOriginPathStr}
appIconPath=${appIconPathStr}
if [ ! -x "$appOriginPath" ];
then
echo "打包路径不存在,程序即将退出"
exit 0
fi
if [ -x "$appName" ]
then
rm -rf "$appName"
echo "Remove folder $appName"
else
echo "folder $appName does not exist"
fi
echo "make dir $appName"
mkdir "$appName"
mkdir "$appPayloadName"
if [ -x "$appDetailName" ]
then
echo "Remove file $appDetailName"
rm -rf "$appDetailName"
fi
echo "copy $appDetailName ..."
cp -r "$appOriginPath" "$appDetailName"
echo "copy $appName to payload"
#替换xxx为app名称
cp -r "$appDetailName" "$appCopyToPayloadPath"
echo "copy icon to iTunesArtwork"
cp "$appIconPath" ${appName}"/iTunesArtwork"
cd "$appName"
echo "start zip..."
zip -r ${appName}".ipa" Payload iTunesArtwork
exit 0
11.运行
参考:
https://www.jianshu.com/p/f3061551a648
https://www.jianshu.com/p/ecf3d9957ebd
http://events.jianshu.io/p/af3d39ffde3a