Skip to content

MonkeyDev

jiaxw32 edited this page Jun 10, 2021 · 3 revisions

动态库签名问题

报错信息

error: An empty identity is not valid when signing a binary for the product type 'Dynamic Library'. (in target 'WXTweak' from project 'WXTweak')

解决方案

在Xcode中该target的build settings 中添加"CODE_SIGNING_ALLOWED=NO", 问题解决.

MonkeyDev 命令行工具编译报错问题

  • 报错信息
unable to resolve product type 'com.apple.product-type.tool' for platform 'iphoneos'
  • 解决方案

打开 project.pbxproj,查找 com.apple.product-type.tool,替换 为com.apple.product-type.application

部分 App 动态库注入失败问题

  1. 编译 optool,复制到 /opt/MonkeyDev/bin 目录下
➜ pwd
/opt/MonkeyDev/bin
➜ ls -l
total 5216
-rwxr-xr-x  1 root  wheel   865268  5 24 10:16 class-dump
-rwxr-xr-x  1 root  wheel      694  5 24 10:16 createIPA.command
-rwxr-xr-x  1 root  wheel  1150448  5 24 10:16 cycript
-rw-r--r--  1 root  wheel    11727  5 24 10:16 dump.js
-rwxr-xr-x  1 root  wheel     9669  5 24 10:16 dump.py
-rwxr-xr-x  1 root  wheel    26115  5 24 10:16 md
-rwxr-xr-x  1 root  wheel     9891  5 24 10:16 md-install
-rwxr-xr-x  1 root  wheel     2940  5 24 10:16 md-uninstall
-rwxr-xr-x  1 root  wheel     3845  5 24 10:16 md-update
-rwxr-xr-x  1 root  wheel   202256  5 24 10:16 monkeyparser
-rwxr-xr-x@ 1 root  wheel   366400  5 28 10:31 optool
  1. 进入 /opt/MonkeyDev/Tools 目录,修改 pack.sh 脚本

新增 optool

# monkeyparser
MONKEYPARSER="${MONKEYDEV_PATH}/bin/monkeyparser"

# optool
OPTOOL="${MONKEYDEV_PATH}/bin/optool"

optool 替换 monkeyparser,注入动态库

if [[ ${MONKEYDEV_INSERT_DYLIB} == "YES" ]];then
	# "$MONKEYPARSER" install -c load -p "@executable_path/Frameworks/lib""${TARGET_NAME}""Dylib.dylib" -t "${BUILD_APP_PATH}/${APP_BINARY}"
	arch -x86_64 "$OPTOOL" install -c load -p "@executable_path/Frameworks/lib""${TARGET_NAME}""Dylib.dylib" -t "${BUILD_APP_PATH}/${APP_BINARY}"
fi

参考

Clone this wiki locally