Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 753
vrwim Avatar asked Nov 29 '25 12:11

vrwim


1 Answers

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.

like image 151
Joseph Gagliardo Avatar answered Dec 02 '25 04:12

Joseph Gagliardo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!