本文介绍了适用于armv7和arm64的Theos的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让theos在OSX Mavericks上工作.我最近购买了iPhone 5s,从那以后越狱了.现在,我正在尝试使Theos工作,以便我可以再次进行一些调整.我已经在OSX Lion和IOS 5和6上运行了它.我有一个非常简单的程序,该程序应在应用程序启动时显示UIAlert.问题是,当我运行make命令以尝试编译我的代码时,出现此错误:

I'm trying to get theos working on OSX Mavericks. I recently purchased an iPhone 5s and have since then jailbroken it. Now I am trying to get Theos working so I can start working on some tweaks again. I had it working on OSX Lion and for IOS 5 and 6. I have a very simple program which should display a UIAlert when an application launches. The problem is, when i run the make command in an attempt to compile my code i get this error:

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代码:

Here is my code for 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

还有我的makefile:

And my makefile:

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"

谢谢!

推荐答案

这是一个老问题,但我仍然认为应该为有相同问题的人回答.您需要调用objc_getClass使其正常工作,如下所示:

It's an old question, but still I figured I should answer it for people who have the same question. You need to call objc_getClass for it to work, like this:

UIAlertView *alert = [[objc_getClass("UIAlertView") alloc] initWithTitle:@"TEST" message:@"message...." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

请注意,作业左侧不需要这样做.

Note that this is not required on the left hand side of the assignment.

这篇关于适用于armv7和arm64的Theos的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-14 12:52