Theos for armv7 and arm64

2020-02-26 02:01发布

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!

6条回答
看我几分像从前
2楼-- · 2020-02-26 02:27

I would say update your Headers. Download new set from rpetrich

查看更多
你好瞎i
3楼-- · 2020-02-26 02:32

To fix the alert issue, you must include UIKit/UIKit.h (Sorry, I can't comment)

查看更多
等我变得足够好
4楼-- · 2020-02-26 02:33

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.

查看更多
该账号已被封号
5楼-- · 2020-02-26 02:36

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.

查看更多
太酷不给撩
6楼-- · 2020-02-26 02:36

If you're using iOS 7, you have to hook the correct method: try -(void)launchFromLocation:(int)location.

Because it uses a parameter, your code should look like this:

-(void)launchFromLocation:(int)location {
    // your stuff
    %orig(location);
}
查看更多
混吃等死
7楼-- · 2020-02-26 02:42

You need to include the UIKit framework in your Makefile by adding XXX_FRAMEWORKS = UIKit where XXX is your project name

查看更多
登录 后发表回答