Note: A technical post follows. If you’re not interested in iPhone programming, you can safely ignore it.
An update to RogueSheep’s Postage app was recently rejected by Apple because of a supposed overriding of a private method in a category. Apple most likely used a static analyzer to determine this problem. As far as I can tell, Apple has a bug in their static analyzer.
Three20 adds a category method
-previousViewController to the UIKit class
UIViewController. According to RogueSheep:
The notice from Apple indicated that we had used a private method of
As far as I can tell, there is no private method in
-previousViewController. There is, however, a private method on UINavigationController (a subclass of UIViewController) called
However, this should not be a problem. Subclasses of
UIViewController which implement
-previousViewController themselves will override the category method defined on
UIViewController by Three20. This includes
UINavigationController and whatever other Apple-defined subclasses exist for
Ultimately, if my analysis is correct, this is just a bug. They happen. Static analyzers are especially difficult to get right, especially when the source isn’t available. This shouldn’t be read as an indictment of Apple, or of Apple’s intentions. They’re just trying to protect the user experience of their products and head off binary compatibility problems.
However, I personally think they’re going to have a difficult time trying to detect private methods with a static analyzer. They might have better luck doing analysis at runtime — checking the actual class hierarchy and interposing on method calls.
Meanwhile, there will be a lot of false positives caused by this, which is going to be frustrating for a lot of iPhone app developers.