General HOOK SBApplicationIcon Launch Get displayName

sencersoylu

macrumors newbie
Original poster
Oct 11, 2012
2
0
Hello,

I hooked Launch but i didnt get displayName. Please help me.

Mycode is
Code:
#import <SpringBoard/SpringBoard.h>
%hook SBApplicationIcon
 
-(void)launch
{
   
 
 
 
NSString *app= [self displayName];
 
NSString *message = [NSString stringWithFormat:@"The app %@ has been launched", app, nil];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:sword message:message delegate:self cancelButtonTitle:sword otherButtonTitles:nil];
    [alert show];
    [alert release];
 
%orig;
 
 
}
%end
 

sencersoylu

macrumors newbie
Original poster
Oct 11, 2012
2
0
What do you get instead?
Code:
Tweak.xm:10: warning: no '-displayName' method found
Tweak.xm:10: warning: (Messages without a matching method signature
Tweak.xm:10: warning: will be assumed to return 'id' and accept
Tweak.xm:10: warning: '...' as arguments.)
Tweak.xm:13: error: 'sword' was not declared in this scope
I gimme that error code.
 

truehybridx

macrumors member
Dec 6, 2010
86
0
Code:
Tweak.xm:10: warning: no '-displayName' method found
Tweak.xm:10: warning: (Messages without a matching method signature
Tweak.xm:10: warning: will be assumed to return 'id' and accept
Tweak.xm:10: warning: '...' as arguments.)
Tweak.xm:13: error: 'sword' was not declared in this scope
I gimme that error code.
Oops.. well i believe i answered it over at ifans, but ill answer it here too lol

Since you are dynamic linking, the compiler has no idea displayName exists as a function.

Heres the easiest way, just declare an interface before your hooks
Code:
@interface SBApplicationIcon : NSObject
 
- (NSString*)displayName;
 
@end
 
%hook SBApplicationIcon
 
- (void)launch {
 
NSString *name = [self displayName];
 
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:name message:@"Launch Been Hooked" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [alert show];
    [alert release];
 
 
%orig;
 
}
 
%end
OR you could include the SBAppIcon.h BUT you may have to fix that header file to make the compiler happy, and possibly fix file after file, so its easiest to just declare what you need in a sort of pseudo-interface and let the runtime figure it out
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.