Mobilesubstrate tweak not loading

844 views Asked by At

I am trying to make simple tweak with iOSOpenDev Captain-Hook tweak. Here is my code:

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "CaptainHook/CaptainHook.h"

CHDeclareClass(TESTCLASS); // declare class

CHOptimizedMethod(0, self, void, TESTCLASS, testm) // hook method (with no arguments and no return value)
{
    // write code here ...
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"HACK" message:@"message" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];

    //CHSuper(0, TESTCLASS, testm); // call old (original) method
    //return nil;
}

CHConstructor // code block that runs immediately upon load
{
    @autoreleasepool
    {
        CHLoadLateClass(TESTCLASS);  // load class (that will be "available later")
        CHHook(0, TESTCLASS, testm); // register hook
    }
}

Also I have plist with filtered bundle of my other app. My other app calls [TESTCLASS testm]. And if I place .plist and .dylib in /Library/MobileSubstrate/DynamicLibraries it not works, nothing happens. But if I add dylib to project in my second app and compile it, it works, even without copying actual dylib to the app(uses that in /Library/MobileSubstrate/DynamicLibraries) and shows my alert. How can I make it work?

Tried with hooking some example calls for springboard - they not work. Using Xcode 5.0.2, iOSOpenDev 1.6-2, iPad1 5.1.1

0

There are 0 answers