0

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.

borrrden
  • 33,256
  • 8
  • 74
  • 109
user2533604
  • 655
  • 1
  • 11
  • 28

1 Answers1

1

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.

Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
  • I tried Method 1. But it is giving "Typedef redefinition with different types" error. – user2533604 Oct 09 '14 at 06:35
  • Where does it show it? I remember, I had to do some cleanup of .h files after they were generated by class-dump-z. As example, I had to remove something like "#import " – Victor Ronin Oct 09 '14 at 16:20