我正在尝试让 theos 在 OSX Mavericks 上工作。我最近购买了一部 iPhone 5s,并从那时起对其进行了越狱。现在我正在尝试让 Theos 工作,这样我就可以再次开始进行一些调整。我让它在 OSX Lion 以及 IOS 5 和 6 上运行。我有一个非常简单的程序,应该在应用程序启动时显示 UIAlert。问题是,当我运行 make 命令尝试编译我的代码时,我收到此错误:
Making all for tweak test...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Linking tweak test...
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_UIAlertView", referenced from:
objc-class-ref in Tweak.xm.b0410391.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [obj/test.dylib.1cc22e7c.unsigned] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [test.all.tweak.variables] Error 2
Williams-MacBook-Pro-2:test williamfsmillie$
这是我的 Tweak.xm 代码:
%hook SBApplicationIcon
-(void)launch{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"TEST" message:@"message...." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
%orig;
}
%end
还有我的生成文件:
export SDKVERSION=7.0
include theos/makefiles/common.mk
TWEAK_NAME = test
test_FILES = Tweak.xm
ARCHS = armv7 arm64
test_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"
Thanks!
这是一个老问题,但我仍然认为我应该为有同样问题的人回答。你需要打电话objc_getClass
为了让它工作,像这样:
UIAlertView *alert = [[objc_getClass("UIAlertView") alloc] initWithTitle:@"TEST" message:@"message...." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
请注意,作业的左侧不需要这样做。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)