Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Theos for armv7 and arm64

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$ 

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

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"

Thanks!

like image 800
user3163990 Avatar asked Dec 06 '22 03:12

user3163990


2 Answers

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.

like image 194
Stefan Wittwer Avatar answered Dec 26 '22 23:12

Stefan Wittwer


Edit your makefile and insert the following at the top:

export ARCHS = armv7 armv7s arm64
export TARGET = iphone:clang:7.0:7.0

Also, link the Foundation framework with your tweak.

like image 27
Vatsal Manot Avatar answered Dec 27 '22 00:12

Vatsal Manot