2

Yes, yes I know this question has been asked A THOUSAND times! Let me explain my situation I am making a jailbreak tweak and I need to use the method [SBApplicationCenter sharedInstance]. So I #import<SpringBoard/SBApplicationController.h>. The weird thing is that it does import! To check this I did Class SBApplicationController = objc.getClass("SBApplicationController"), this returned a few warnings, one of those warnings was something along the lines of, "SBApplicationController already defined, redefined in a different way". Furthermore when I click "SBApplicationController" and do "Jump to definition" it takes me to "SBApplicationController.h". Before anyone suggest that I "link it to my binary", I can't this is NOT a framework, this is the dumped header files. (And I have tried linking just the SBApplicationCenter.h, that didn't work obviously). Any help would be great. Here's my code:

#import <SpringBoard/SBApplication.h>
#import <SpringBoard/SBApplicationController.h>


SBApplication* app = [[SBApplicationController sharedInstance] applicationWithDisplayIdentifier:@"com.yourcompany.appname"];
NSString *notificationIdentifier = app.bundleIdentifier;
bstpierre
  • 30,042
  • 15
  • 70
  • 103
Milk Tea
  • 141
  • 5

2 Answers2

1

Ok I fixed it and just used:

Class $SBApplicationController = (objc_getClass("SBApplicationController"));

Milk Tea
  • 141
  • 5
0

I know this is an old question, but if you are using logos there is a better fix for this answer. You can use

SBApplicationController *apc = [%c(SBApplicationController) sharedInstanceIfExists];