移动基板:架构armv7的未定义符号:" _main"

时间:2017-03-20 17:50:00

标签: ios objective-c cydia

我正在编写一个在应用程序中注入代码的调整。

要做到这一点,我在这个SO问题中遵循了指南: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
    );
}

生成文件:

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

由于

1 个答案:

答案 0 :(得分:1)

通过用

替换完整的Makefile来修复
include $(THEOS)/makefiles/common.mk

TWEAK_NAME = test8
test8_FILES = test.m 

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
    install.exec "killall -9 SpringBoard"