只要在 entitlement 裏面添加如下字段:
<key>get-task-allow</key>
<true/>
就代表該執行文件可以被debug。
修改方法如下:
1、將需要debug的執行文件copy到 mac上。2、使用ldid 工具,導出其code sign
ldid -e helloworld >> helloworld.txt
3、修改其code sign,添加上述字段
4、重新對齊進行code sign
ldid -Shelloworld.txt ./helloworld
5、copy 回 設備上,修改權限爲 755
chmod 755 ./helloworld
6、打開XCode -》Product -》Attach to Process -> By Process PID 填入 helloworld
啓動程序則自動開始調試。
當然,這個方法適合越獄設備,因爲這樣才能對其賦予權限。
app也必須是不通過apple store發佈的版本,因爲apple會對每個app 進行簽名加密。
將來會說明一下如何對加密的設備進行debug。