iOS Theos

2018-06-06  本文已影响67人  突刺刺

一. Theos简介

二. Theos安装

1. 配置ldid和dpkg-deb
brew install ldid
brew install dpkg
2. 安装Theos
sudo git clone --recursive https://github.com/theos/theos.git /opt/theos
export THEOS="/opt/theos"
3. 测试Theos是否安装成功
cd /Users/Users/Documents/
/opt/theos/bin/nic.pl 
skylinedeiMac:Documents skyline$ /opt/theos/bin/nic.pl
NIC 2.0 - New Instance Creator
------------------------------
  [1.] iphone/activator_event
  [2.] iphone/application_modern
  [3.] iphone/cydget
  [4.] iphone/flipswitch_switch
  [5.] iphone/framework
  [6.] iphone/ios7_notification_center_widget
  [7.] iphone/library
  [8.] iphone/notification_center_widget
  [9.] iphone/preference_bundle_modern
  [10.] iphone/tool
  [11.] iphone/tweak
  [12.] iphone/xpc_service
Choose a Template (required): 
11
Project Name (required): tweakTestProject   (随便起)  
Package Name [com.yourcompany.tweaktestproject]: com.yourcompany.tweaktestproject
Author/Maintainer Name [skyline]: 作者的名字
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.apple.springboard 
```如果作用的对象是系统,直接根据提示填:com.apple.springboard```
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: SpringBoard
```如果要重启系统就填 SpringBoard ```
Instantiating iphone/tweak in tweaktestproject/...
Done.
skylinedeiMac:Documents skyline$ ls /Users/skyline/Documents/tweaktestproject 
Makefile        control
Tweak.xm        tweakTestProject.plist

三. Theos文件说明

Package: com.yourcompany.tweaktestproject  /*deb包的名字组成部分之一*/
Name: tweakTestProject
Depends: mobilesubstrate  /*描述满足deb包运行的条件,如果不满足,tweak无法正常运行。比如 Depends:mobilesubstrate,firmware(>=8.0),tweak必须在高于iOS8.0系统下运行,*/
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome MobileSubstrate tweak!  /*deb包的描述,在Cydia可以看到,随意更改*/
Maintainer: tucici  /*deb包的维护人,在Cydia可以看到,随意更改*/
Author: tucici  /*deb包的作者,在Cydia可以看到,随意更改*/
Section: Tweaks /*deb包所属的程序类型,不能更改*/
export THEOS_DEVICE_IP = 192.xxx.1.xxx /*这一步很重要,填越狱手机IP,默认文件没有这个参数,需手动设置,而且必须放在第一行*/
include $(THEOS)/makefiles/common.mk /*THEOS就是建立Theos工程时,初始化的一个全局变量  export THEOS="/opt/theos"*/

TWEAK_NAME = tweakTestProject
tweakTestProject_FILES = Tweak.xm myclass.m city.xml/*设置工程需要引用的文件,多个文件之间用空格分隔开,可以添加自定义的文件*/
tweakTestProject_FRAMEWORKS = UIKit /*添加TWEAK依赖的库,多个库之间用空格分隔开,默认没有,自行添加*/
export ARCHS = armv7 arm64 /*支持处理器架构,用空格隔开,默认文件没有这个参数,默认没有,自行添加*/
TARGET = iphone:7.0:7.0  /*指定设备为iphont : 指定Xcode用7.0版本的SDK编译 : 指定发布手机最低系统为7.0,默认没有,自行添加*/
include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
    install.exec "killall -9 SpringBoard" /*表示tweak安装之后,需要杀掉的进程,killall -9 SpringBoard 就是系统重启,killall -9 WeChat就是微信重启*/

四. 常见问题

Makefile:4: /makefiles/common.mk: No such file or directory
Makefile:18: /tool.mk: No such file or directory
make: *** No rule to make target `/tool.mk`. Stop.

解决办法:重新安装Theos即可

bash: /Applications/Xcode: No such file or directory
==> Error: You do not have any SDKs in /Application/Xcode 7.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs or /opt/theos/sdks
make: *** [before-all] Error 1

解决办法: 比如要指定Xcode7为活动Xcode。(Xcode的名字一定要正确,注意Xcode7和Xcode 7的区别)

sudo xcode-select -s /Applications/Xcode7.app/Contents/Developer
> Making all for tool cargodaemon...
make[2]: Nothing to be done for `internal-tool-compile`.

解决办法:

make clean```清除上次make命令所产生的文件```
Can't locate IO/Compress/Lzma.pm in @INC (you may need to install the IO::Compress::Lzma module) ...

解决办法:(MacOS修改文件权限-->戳这里)
cd /opt/theos/vendor/dm.pl/

注释掉第dm.pl中的12、13行
//use IO::Compress::Lzma;
//use IO::Compress::Xz;

cd /opt/theos/makefiles/package/

deb.mk中第6行lzma改为gzip
_THEOS_PLATFORM_DPKG_DEB_COMPRESSION ?= gzip

五. 其他

五. 参考资料

上一篇 下一篇

猜你喜欢

热点阅读