Thanks for the reply KennyTM. I have changed my code to his after your advice.
#define MSHookMessageEx(class, selector,replacement,result) \
(*(result) = method_setImplementation(class_getInstanceMethod((class), (selector)), (replacement)))
static IMP original_Launch;
static void __$AnotherCheck_AppIcon_Launch(SBApplicationIcon *_SBApplicationIcon)
{
UIAlertView* __launchView = [[UIAlertView alloc] init];
__launchView.title = @"No way muchacho";
__launchView.message = @"You can't touch dis!";
[__launchView addButtonWithTitle:@"Dismiss"];
[__launchView show];
}
extern "C" void AnotherCheckInitialize()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// Get the SBApplicationIcon class
Class _$SBAppIcon = objc_getClass("SBApplicationIcon");
MSHookMessageEx(_$SBAppIcon, @selector(launch), __$AnotherCheck_AppIcon_Launch, (IMP *) &original_Launch);
[pool release];
}
But i m getting these 2 errors at MSHookMessageEx line
error: invalid conversion from 'void ()(SBApplicationIcon)' to 'objc_object* (*)(objc_object*, objc_selector*, ...)'
error: initializing argument 2 of 'objc_object* (* method_setImplementation(objc_method*, objc_object* (*)(objc_object*, objc_selector*, ...)))(objc_object*, objc_selector*, ...)'
Any advice on these please?