user2533604
user2533604

Reputation: 665

Access SpringBoardServices.h method in objective-c?

I downloaded SpringBoardServices.h file given in SpringBoardServices and added it to my project. But how to access one of the method present inside SpringBoardServices.h file. I am trying to call BOOL SBSProcessIDForDisplayIdentifier(CFStringRef identifier, pid_t *pid); this method present inside SpringBoardServices.h from MyClass.m file. How to call above method from my .m file?

I used below approach, but it is returning null.
Class myclass = NSClassFromString(@"SpringBoardServices");
NSLog(@" myclass %@", myclass); //null
id myobj = [[myclass alloc] init];

I downloaded SpringBoardServices.h file from this link.

Upvotes: 0

Views: 308

Answers (1)

Victor Ronin
Victor Ronin

Reputation: 23268

There are couple of methods to access C methods from private framework:

Method 1:

  • Link a private framework (similar to the way how you link public framework)
  • Include .h file
  • Do a call:

SBSProcessIDForDisplayIdentifier(...)

Method 2:

  • Load framework in runtime using dlopen
  • Find a method using dlsym
  • Do a call

BTW. This is applicable to C method's and second method won't work for ObjectiveC methods.

Upvotes: 1

Related Questions