Search code examples
iosiphone-privateapi

How do I use this private API?


I have found the class PSCellularDataSettingsDetail and its method +(void)setEnabled:(BOOL)enabled;, which I think will give me what I need, which is accessing the mobile data setting.

I found this method by opening up the compiled Preferences.framework using class-dump-z.

Now I found this answer and tried to access the class and method that way, but the class is private too. How can I open this class up to Xcode?


Solution

  • Have you tried calling performSelector? That is usually the trick to call private methods. Remember all that makes a method private in Objective-C is the fact that it is not advertised in the h file. But if you send a message to an object and the object can respond to that message it will, regardless of what's in the header file.