1、新建Xcode项目,项目名要和我们调试的项目名一样
2、添加一个脚本Run Script
脚本如下:
/opt/iOSOpenDev/bin/iosod ----xcbp
#当前生成目标文件.app的目录
cd ${TARGET_BUILD_DIR}
#赋值不能用空格
bundleid=clf.xxx
teamid="xxx"
targetpath=/Users/clf/Desktop/breakApp/XcodeRun/
appid="${teamid}.${bundleid}"
# 1.copy files
cp -rf ${targetpath}/TargetApp.app `pwd`
cp ${targetpath}/embedded.mobileprovision ./TargetApp.app/
rm -rf ./TargetApp.app/_CodeSignature
chmod +x ./TargetApp.app/TargetApp
# 3.replace str
plutil -replace com.apple.developer.team-identifier -string ${teamid} ${targetpath}/entitlements.plist
plutil -replace application-identifier -string ${appid} ${targetpath}/entitlements.plist
plutil -replace CFBundleIdentifier -string ${bundleid} ./TargetApp.app/Info.plist
# 4.resign
codesign -fs "iPhone Developer:xxx (xxx)" --no-strict --entitlements=${targetpath}/entitlements.plist ./TargetApp.app
该脚本实现偷梁换柱
首先将第三方app拷贝替换我们新建工程生成的app
然后对第三方app使用我们的证书进行签名
最后将签名后的第三方app安装至iPhone上
3.点击Debug-->Pause,就可以进入lldb调试
利用facebook的工具chisel
1)brew install chisel
2)~/.lldbinit (没有就新建)
3)command script import /path/to/fblldb.py
错误集:
1、X-code运行报错: This application’s application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed.
解决办法: application-identifier冲突,把手机上的软件卸载一下就OK了.