arm7和arm64的Theos

use*_*990 4 objective-c cydia jailbreak 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$ 
Run Code Online (Sandbox Code Playgroud)

这是我的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
Run Code Online (Sandbox Code Playgroud)

我的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"
Run Code Online (Sandbox Code Playgroud)

谢谢!

Ste*_*wer 6

这是一个老问题,但我仍然认为我应该回答那些有同样问题的人.您需要调用objc_getClass它才能工作,如下所示:

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

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

  • 您也可以使用`%c(UIAlertView)`而不是`objc_getClass("UIAlertView")` (3认同)

Vat*_*not 5

编辑您的makefile并在顶部插入以下内容:

export ARCHS = armv7 armv7s arm64
export TARGET = iphone:clang:7.0:7.0
Run Code Online (Sandbox Code Playgroud)

另外,将Foundation框架与您的调整相关联.