1
我正在編寫一個在應用程序中注入代碼的調整。移動基板:架構armv7的未定義符號:「_main」
要做到這一點,我跟着這太問題的指南:iOS - Add "objects" to existing app (jailbroken)
我嘗試過,但我得到這個錯誤時建築:
Undefined symbols for architecture armv7: "_main"
代碼:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import <objc/runtime.h>
#import <substrate.h>
static IMP __original_init; // A
id __modified_init(id __self, SEL __cmd, CGRect frame) // B
{
__self = __original_init(__self, __cmd, frame); // C
// D
UIButton *newButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[newButton setTitle:@"Please, laat het werken!" forState:UIControlStateNormal];
newButton.frame = CGRectMake(0, 0, 100, 40);
[__self addSubview:newButton];
return __self;
}
// E
__attribute__((constructor))
void init()
{
MSHookMessageEx(
objc_getClass("YTHUDMessageView"),
@selector(initWithFrame:),
(IMP)__modified_init,
&__original_init
);
}
的Makefile :
include $(THEOS)/makefiles/common.mk
APPLICATION_NAME = test8
test8_FILES = test.m
test8_FRAMEWORKS = UIKit CoreGraphics
test8_LIBRARIES = substrate
include $(THEOS_MAKE_PATH)/application.mk
after-install::
install.exec "killall \"test8\"" || true
由於