iphoneobjective-cjailbreaktheoslogos

Get Application Icon Image From Springboard (Jailbreak)


I'm developing a lockscreen application using theos and part of the functionality requires icon images of certain applications on the phone. How can I go about getting those icon images and displaying them on the lockscreen of the phone?

I've tried everything I could think of so far and have searched through the springboard headers with no luck. I've specifically been trying retrieving the images from SBApplication and SBIconModel from suggestions I found through google, but still I have no luck.

Any help is greatly appreciated. Thanks!


Solution

  • After you %hook a class, inside the method you're using, do the following if for example you're trying to get the icon for the mail app

    // Get the SBApplication for the mail app
    Class $SBApplicationController = objc_getClass("SBApplicationController");
    SBApplication *mailApp = [[$SBApplicationController sharedInstance] applicationWithDisplayIdentifier:@"com.apple.mobilemail"];
    
    // Get the SBApplicationIcon for the mail app
    SBApplicationIcon *mailAppIcon = [[objc_getClass("SBApplicationIcon") alloc] initWithApplication:mailApp];
    

    The important thing is to get the right DisplayIdentifier of the app you're interested in.

    Hope this help! any problems please shout.