1.安裝brew,並安裝ldid
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ldid
2.修改用戶的環境配置
vim ~/.bash_profile //這個只是其中的一種方法
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
source ~/.bash_profile //環境變量立刻生效
3.下載theos
git clone --recursive https://github.com/theos/theos.git $THEOS
4.新建tweak項目
找一個目錄存放代碼
cd ~/Desktop
nic.pl
填寫項目信息
Project Name
項目名稱
Package Name ID
項目ID
Author/Maintainer Name
作者
默認是mac的用戶名
[iphone/tweak] MobileSubstrate Bundle filter
需要修改APP的Bundle Idetifier
可以通過Cycript查看APP的Bundle Identifier
[iphone/tweak] List of applications to terminate upon installation
可以直接默認就好
5.編輯Makefile文件
在前面加入環境變量,寫清楚通過那個IP和端口號訪問手機
THEOS_DEVICE_IP
THEOS_DEVICE_PORT
export THEOS_DEVICE_IP=127.0.0.1 export THEOS_DEVICE_PORT=10010
include $(THEOS)/makefiles/common.mk TWEAK_NAME = ting_tweak
ting_tweak_FILES = Tweak.xm
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
如果不希望每個項目的MakeFile都編寫IP和端口號環境變量,也可以添加到用戶配置文件中
$ vim ~/.bash_profile
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
export THEOS_DEVICE_IP=127.0.0.1
export THEOS_DEVICE_PORT=10010
$ source ~/.bash_profile
6.編寫代碼
%hook XMAdAnimationView
- (id)initWithImageUrl:(id)arg1 title:(id)arg2 iconType:(long long)arg3 jumpType:(long long)arg4
{
return nil; }
%end
%hook XMSoundPatchPosterView
- (id)initWithFrame:(struct CGRect)arg1 {
return nil; }
%end
7.編譯-打包-安裝
編譯 make
打包成deb make package
安裝 make install