2017-03-20 2 views
1

J'écris un tweak qui injecte du code dans une application.Substrat mobile: symboles non définis pour l'architecture armv7: "_main"

Pour ce faire, j'ai suivi le guide dans cette question SO: iOS - Add "objects" to existing app (jailbroken)

Je l'ai essayé, mais je reçois cette erreur lors de la construction:

Undefined symbols for architecture armv7: "_main" 

code:

#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 

Merci

Répondre

1

fixe en remplaçant le plein Makefile avec

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"