starcwl
(chan)
2015 年7 月 21 日 01:57
1
我的Tweak.xm中的内容:
%hook SpringBoard
- (void) applicationDidFinishLaunching:(id)application
{
NSLog(@"hello ios");
%orig;
// 下面有个错误
UIAlrtView *alert = [[UIAlertView alloc] initWithTitle:@"hello world" message:@"cat dog pig." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]];
[alert show];
[alert release];
}
%end
control 文件中的内容
Package: com.self.helloworld
Name: iOSREHelloWorld
Depends: mobilesubstrate
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome MobileSubstrate tweak!
Maintainer: starcwl
Author: starcwl
Section: Tweaks
Makefile文件中的内容:
THEOS_DEVICE_IP = iosip
ARCHS = armv7 arm64
TARGET = iphone:latest:8.0
include theos/makefiles/common.mk
TWEAK_NAME = iOSREHelloWorld
iOSREHelloWorld_FILES = Tweak.xm
iOSREHelloWorld_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
上面UIAlertview明显写错了,可是我用make编译,没有报错,下载到手机中tweak没有工作,请问我怎么判断我的Tweak.xm 被成功编译了?
Making all for tweak iOSREHelloWorld...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Linking tweak iOSREHelloWorld...
Stripping iOSREHelloWorld...
Signing iOSREHelloWorld...
makefile贴上来看看?
Theos更新一下试试
starcwl
(chan)
2015 年7 月 21 日 02:11
5
Makefile已更新~ ~~
theos是前两天刚装的。
不知道哪里出问题了,我刚pull了一下Theos,一切正常:
Tweak.xm:7:2: error: unknown type name 'UIAlrtView'; did you mean 'UIAlertView'?
UIAlrtView *alert = [[UIAlertView alloc] initWithTitle:@"hello w...
^~~~~~~~~~
UIAlertView
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:24:40: note:
'UIAlertView' declared here
NS_CLASS_AVAILABLE_IOS(2_0) @interface UIAlertView : UIView
^
Tweak.xm:7:156: error: extraneous ']' before ';'
...dog pig." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]];
^
2 errors generated.
starcwl
(chan)
2015 年7 月 21 日 02:43
10
可以把你修改后编译成功的整个项目文件发我邮箱一下吗?我对比着看一下。我的邮箱star_cwl@163.com 谢谢~
我没有编译成功,我是直接复制的你的源代码,编译报错了
starcwl
(chan)
2015 年7 月 21 日 05:10
13
找到问题了,
我的代码有问题,修改默认Tweak.xm时我是从%hook 开始删除到结尾,没注意顶部有个 /* 注释,导致全部代码被注释了,奇怪的是,为什么未关闭的注释不报错。
完整的Tweak.xm
/* How to Hook with Logos
Hooks are written with syntax similar to that of an Objective-C @implementation.
You don't need to #include <substrate.h>, it will be done automatically, as will
the generation of a class list and an automatic constructor.
%hook SpringBoard
- (void) applicationDidFinishLaunching:(id)application
{
NSLog(@"hello ios");
%orig;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"hello world" message:@"cat dog pig." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
%end
snake7788
(snake7788)
2016 年5 月 30 日 02:48
14
亲,我跟你遇到同样的问题,但我不是注释的问题,重装了theos问题依旧