Theos for armv7 and arm64

匿名 (未验证) 提交于 2019-12-03 01:47:02

问题:

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!

回答1:

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.



回答2:

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.



回答3:

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



回答4:

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); } 


回答5:

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



回答6:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!