需求
最近在学习英语,下载了《每日英语听力》APP。使用几天之后,发现没有中文翻译,VIP权限限制,用起来不顺畅。萌生修改的想法,纯属学习,记录历程。(需越狱手机)
想法
一、 导出APP中的头文件。
在这些头文件中,发现一个UserInfo类,其中有+ (BOOL)isVip函数。
get it!
二、 Theos
安装相关配置:
- Theos
$ export THEOS=/opt/theos
$ sudo git clone git://github.com/DHowett/theos.git $THEOS
# password
$ sudo -s
# password
$ cp -R Desktop/nq/myTheos/ldid /opt/theos/bin
$ sudo chmod 777 /opt/theos/bin/ldid
- CydiaSubstrate
$ sudo /opt/theos/bin/bootstrap.sh substrate
$ sudo -s
# password
$ cp -R Desktop/nq/myTheos/libsubstrate.dylib /opt/theos/lib/libsubstrate.dylib
$ sudo chmod 777 /opt/theos/lib/libsubstrate.dylib
$ cp ~/Desktop/nq/myTheos/dpkg-deb.pl /opt/theos/bin/
$ sudo chmod 777 /opt/theos/bin/dpkg-deb.pl
- Theos NIC templates
$ cp ~/Desktop/nq/myTheos/theos-nic-templates-master/cydget.nic.tar /opt/theos/templates/iphone/
$ cp ~/Desktop/nq/myTheos/theos-nic-templates-master/framework.nic.tar /opt/theos/templates/iphone/
$ cp ~/Desktop/nq/myTheos/theos-nic-templates-master/notification_center_widget.nic.tar /opt/theos/templates/iphone/
$ cp ~/Desktop/nq/myTheos/theos-nic-templates-master/sbsettingstoggle.nic.tar /opt/theos/templates/iphone/
$ cp ~/Desktop/nq/myTheos/theos-nic-templates-master/xpc_service.nic.tar /opt/theos/templates/iphone/
创建工程:
- 启动NIC
$ /opt/theos/bin/nic.pl
输入iphone/tweak对应的数字,如为 9:
Choose a Template (required): 9
注:导出头文件时已知com.eusoft.ting-en和tingen,其余可自填
Project Name (required): hooktingen
Package Name [com.yourcompany.hooktingen]: com.leek.tingen
Author/Maintainer Name [leek]: leek
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.eusoft.ting-en
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: tingen
Instantiating iphone/tweak in iosregreetings/...
编写Tweak.xm:
现在可以修改之前发现的UserInfo类。
%hook UserInfo
+ (BOOL)isVip
return YES;
}
%end
修改Makefile
添加THEOS_DEVICE_IP,192.168.96.180为iPhoneIP,需与电脑同一网络。
THEOS_DEVICE_IP = 192.168.96.180
安装
make package install
结果
进入APP以后,发现部分VIP功能可用,界面卡顿。
哪里出了问题,如何处理?下回分解。