为什么80%的码农都做不了架构师?>>>
http://www.jianshu.com/p/6a872dea187e
打开.xm文件,目前没有发现啥编辑器可以打开,命令行是万能的
open -e /Users/wanggang/Downloads/nixianggongchenggood/iosregreetings/Tweak.xm
.xm文件中输入汉字报错,汉字在xcode中写好黏贴进.xm文件
==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (armv7)…
Tweak.xm:3:24: error: non-ASCII characters are not allowed outside of literals
and identifiers
NSString *str = @“看专”;
^
Tweak.xm:3:33: error: non-ASCII characters are not allowed outside of literals
and identifiers
NSString *str = @“看专”;
^
Tweak.xm:3:23: error: unexpected '@' in program
NSString *str = @“看专”;
^
报错:/makefiles/common.mk: No such file or directory
Makefile:11: /tweak.mk: No such file or directory
解决办法:include /opt/theos/makefiles/common.mk
和include /opt/theos/makefiles/tweak.mk
,虽说这样写不是很好,但是没有找到其他的方法,其他的按照文档一步步的来,傻瓜式的
THEOS_DEVICE_IP = 192.168.1.100
ARCHS = armv7 arm64
TARGET = iphone:latest:8.0
include /opt/theos/makefiles/common.mk
TWEAK_NAME = iOSREGreetings
iOSREGreetings_FILES = Tweak.xm
iOSREGreetings_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
报错: Preprocessing Tweak.xm…
Tweak.xm:2: error: Tweak.xm…的问题重新写
==> Preprocessing Tweak.xm…
Tweak.xm:2: error: %end does not make sense inside a block
make[3]: *** [/Users/wanggang/Downloads/nixianggongchenggood/iosregreetings/.theos/obj/debug/armv7/Tweak.xm.07780871.o] Error 22
make[2]: *** [/Users/wanggang/Downloads/nixianggongchenggood/iosregreetings/.theos/obj/debug/armv7/iOSREGreetings.dylib] Error 2
make[1]: *** [internal-library-all_] Error 2
make: *** [iOSREGreetings.all.tweak.variables] Error 2
wanggangdeMacBook-Pro:iosregreetings wanggang$ make package install
报错Error: The vendor/include and/or vendor/lib directories are missing. Please run git submodule update --init --recursive
in your Theos directory.* 按照这个文档 https://github.com/theos/theos/wiki/Installation,一步步的配置,重点说说文档这一句add to your ~/.bash_profile or equivalent:export PATH=/usr/local/opt/gnu-sed/bin/:$PATHIn order to use make troubleshoot
,需要用命令行打开open ~/.bash_profile
打开和添加示意图
==> Error: The vendor/include and/or vendor/lib directories are missing.
Please run `git submodule update --init --recursive` in your Theos directory.
More information: https://github.com/theos/theos/wiki/Installation.
control文件
Package: com.iosre.iosregreetings
Name: iOSREGreetings
Depends: mobilesubstrate
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome MobileSubstrate tweak!
Maintainer: snakeninny
Author: snakeninny
Section: Tweaks
makefile文件
THEOS_DEVICE_IP = 192.168.1.100
ARCHS = armv7 arm64
TARGET = iphone:latest:8.0
include /opt/theos/makefiles/common.mk
TWEAK_NAME = iOSREGreetings
iOSREGreetings_FILES = Tweak.xm
iOSREGreetings_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
tream.xm文件
%hook SBLockScreenDateViewController
- (void)setCustomSubtitleText:(id)arg1 withColor:(id)arg2
{
NSString *str = @"主人翁健康专注小儿推拿!";
%orig(str, arg2);
}
%end
%hook SpringBoard
- (void)applicationDidFinishLaunching:(id)application
{
%orig;
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Come to http://bbs.iosre.com for more fun!" message:nil delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
%end
最后编译运行
这么问题解决了展示下最后做的效果
Snip20160702_11.png
作者:wg689
链接:http://www.jianshu.com/p/6a872dea187e
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。