AppStore rejection for UIViewAdditions previousViewController?

54 views
Skip to first unread message

Matt Pelletier

unread,
Nov 20, 2009, 4:58:09 PM11/20/09
to Three20, jona...@eastmedia.com
There is a blog post by Rogue Sheep explaining that an app of theirs
was rejected for making a call to previousViewController. Even though
this three20 Category method does not appear to make private calls, it
overwrites an SDK private method of the same name.

http://blog.roguesheep.com/2009/11/19/warning-love-hurts/

I suggest it be changed to findPreviousViewController, in keeping with
a similar pattern followed to findFirstResponder

Thoughts / comments? Has anyone else been rejected for this reason?

Matt

David Morford

unread,
Nov 20, 2009, 5:38:14 PM11/20/09
to thr...@googlegroups.com
I class dumped UIKit in the 3.1.2 SDK and took a look at the headers. previousViewController is defined on a single class, UINavigationController, not UIViewController. Considering how the ObjC runtime treats categories, I do not see a problem with the current code since the UINavigationController method implementation would replace the method defined on the UIViewController category. Also, since UINavigationController is not supposed to be subclassed, how would that method get invoked except within a subclass of UINavigationController?

The question I have for Apple is *why* these various methods are not prefixed with an underscore to clearly indicate they are private, thus avoiding naming conflicts.

The "offending" method should be renamed, sadly, to something less meaningful. The thought of class dumping every framework before I even sit down to write a new set of features or design a new class cluster just to avoid private name conflicts fills me with dread.

David
> --
>
> You received this message because you are subscribed to the Google Groups "Three20" group.
> To post to this group, send email to thr...@googlegroups.com.
> To unsubscribe from this group, send email to three20+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/three20?hl=.
>
>

Alan Rogers

unread,
Nov 20, 2009, 8:41:25 PM11/20/09
to Three20
If you run your app with the environment variable:

OBJC_PRINT_REPLACED_METHODS=YES

Set you should get some log messages in the console detailing which
methods have been replaced by categories. Then it is just a matter of
making sure the overridden methods are not private OR undocumented.

Running this on my app that is using Three20, I found the following
methods on UIView were overriden by a category in Three20

- (void) setSize:(CGSize)
- (void) setOrigin:(CGPoint)

David Morford

unread,
Nov 20, 2009, 9:17:58 PM11/20/09
to thr...@googlegroups.com
Good tip Alan. Thanks. Using mostly undocumented env settings to find conflicts flips my ironic bit but more info here if anyone is curious...

http://www.opensource.apple.com/source/objc4/objc4-437.1/runtime/objc-private.h

Cheers,
David
Reply all
Reply to author
Forward
0 new messages