View Full Version : Can I override documented private methods?
Jan 17, 2011, 07:24 PM
Here's a private method of UISearchDisplayController. I want to subclass this class and override a private method. I think I'm in the clear with what I want to do, but I just want to double-check...
- (void)setActive:(BOOL)visible animated:(BOOL)animated is documented at http://developer.apple.com/library/ios/#documentation/uikit/reference/UISearchDisplayController_Class/Reference/Reference.html.
Will my app be rejected if I override this method?
Jan 17, 2011, 07:59 PM
What makes you think that method is private? Seems awfully public to me, given that it's published in the class reference.
Jan 18, 2011, 12:02 PM
Whoops...you're 100% right. I found an article talking about it and it had mentioned it was a private method. It must have been a typo. I should have been convinced otherwise after reading the documentation but I blame sleep deprivation!
Thanks again dejo.
Jan 18, 2011, 12:32 PM
As an answer to the generic question though I would say it's highly undesirable to do so for a couple of reasons:
1) Apple may choose to make the method public in future
2) Apple will, most likely, reject your app for using private methods as they scan for the method name
Jan 19, 2011, 02:59 PM
Thanks robbieduncan, that was the general feeling I was getting. Fortunately for me that the method I needed was actually public, because there is no other way to do what I wanted to do.
Thanks both of you,