今天试了下Theos开发越狱插件,当然是很简单的那种,编译过程中遇到些许问题,自己做下笔记
myhlolideMac:~ myhloli$ cd Code
myhlolideMac:Code myhloli$ cd iosre
myhlolideMac:iosre myhloli$ make
/Users/myhloli/Code/iosre/theos/makefiles/targets/Darwin/iPhone.mk:21: *** first argument to `word’ function must be greater than 0. Stop.
这里make出错,猜测是没有引入sdk,解决方法是
myhlolideMac:iosre myhloli$ cd
myhlolideMac:~ myhloli$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
Password:
在这里继续出错
xcode-select: error: invalid developer directory ‘/Applications/Xcode.app/Contents/Developer/’
后来发现是因为我使用的是xcode的beta版,地址需要更改
myhlolideMac:~ myhloli$ sudo xcode-select -switch /Applications/Xcode6-Beta.app/Contents/Developer/
将Xcode.app改为Xcode-Beta成功解决问题。
继续编译
Tweak.xm:8:47: error: non-ASCII characters are not allowed outside of literals and identifiers
message:nil delegate:self cancelButtonTitle:@“OK” otherButtonTitle:nil];
^
Tweak.xm:8:52: error: non-ASCII characters are not allowed outside of literals and identifiers
message:nil delegate:self cancelButtonTitle:@“OK” otherButtonTitle:nil];
^
根据提示明显是因为引号有问题,仔细排查,是mac自带的文本编辑器有自动修正功能,将英文双引号改为中文双引号,导致出错,关闭自动修正并改成英文标点解决。
继续编译
Tweak.xm:7:44: error: instance method ‘-initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitle:’ not
found (return type defaults to ‘id’); did you mean
‘-initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:’? [-Werror,-Wobjc-method-access]
…*alert = [[UIAlertView alloc] initWithTitle:@”Hello,Tweak!”
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:
方法initWithTitle最后一个参数为otherButtonTitles,因为粗心少了一个s导致出错,而且看了很多遍都没看出来这个问题,最后在群里问了下,狗神给指出来了TAT,又丢人了
myhlolideMac:iosre myhloli$ make
Making all for tweak iosRE…
Preprocessing Tweak.xm…
Compiling Tweak.xm…
Linking tweak iosRE…
Stripping iosRE…
Signing iosRE…
myhlolideMac:iosre myhloli$ make package
Making all for tweak iosRE…
make[2]: Nothing to be done for `internal-library-compile’.
Making stage for tweak iosRE…
dpkg-deb:正在新建软件包“com.naken.iosre”,包文件为“./com.naken.iosre_1.0-1_iphoneos-arm.deb”。
最后成功编译并打包,经测试可以在越狱的5s上面安装,程序在cydia中显示正常,但是未能完成应实现的功能。
最后在群内大神的帮助下解决问题,问题的原因是5s使用的64位处理器,不能用armv7指令集,所以需要在Makefile里将armv7更改为arm64
最终程序效果