General HOOK SBApplicationIcon Launch Get displayName

Discussion in 'Jailbreaks and iOS Hacks' started by sencersoylu, Oct 11, 2012.

  1. macrumors newbie

    Joined:
    Oct 11, 2012
    #1
    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
     
  2. macrumors member

    Joined:
    Dec 6, 2010
    #2
    What do you get instead?
     
  3. thread starter macrumors newbie

    Joined:
    Oct 11, 2012
    #3
    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.
     
  4. macrumors member

    Joined:
    Dec 6, 2010
    #4
    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
     

Share This Page