views:

337

answers:

3

Are there greater chances of my app getting rejected by Apple if I use a custom category to extend the functionality of an UIKit interface element, let's say UIButton?

Clarification: I'm thinking about implementing a toggle UIButton, that will alternate between pressed/released states on each tap.

+2  A: 

That sounds like what categories are for... You're extending the UIButton, which is a standard OO technique. As long as your category doesn't break any rules itself (i.e. accessing undocumented internal code) I'd think you'd be fine, subject to the standard disclaimers about nobody knowing why Apple does the things it does at times...

jasondoucette
+1  A: 

You can use custom categories to do whatever you want. If you include a private API, chances are you will not be rejected, but you may find yourself in a pickle if they change the API. It is good practice to wrap any methods that use a private API in a @try block, and include a workaround in case the worst happens

coneybeare
Sorry, but that's not correct. If you use a private API, you will almost certainly get rejected. Apple rejects such applications specifically because private APIs are fragile. While it's true that some applications that use private APIs get accepted anyway, you're far better off keeping away from those methods.
Alex
Beyond checking that your app is accessing some forbidden hardware or framework, app reviewers have no way to check whether you're using some private API. You wouldn't get rejected for using or overriding some private method of UIButton because there's no way for them to detect it.
Darren
Alex, While yours and my experiences are purely anecdotal, Darren is correct. Apple has no way of detecting whether or not you are using private API's. All I can say is that in 15 apps, many of which are high-profile apps, I have never had an app be rejected for using private API's. Some have been quite obvious too… I change a UISwitch color to the Orange color. I edit MPMoviePlayer to look how I want. Point is, Apple will never know if I have used their undocumented methods or created my own. I would appreciate a reversal of your down-vote as both of our responses are anecdotal.
coneybeare
+1  A: 

Of course you can extend the functionality of UIButton through categories or by sub-classing.

HIG violations are the most common cause of app rejection and that's what I'd be concerned about. But that's your judgement call. The worst that can happen is that they ask you fix it.

Darren