Since private methods are not private in Objective-C (the method dispatch mechanism does not distinguish between private v / s public methods), it is very easy for a subclass to override private superclass methods (more on this Cocoa Coding Guide ).
However, discovering this is not so simple. I am looking for a ready-made tool that can help me with this.
It is not just a static analysis tool because private methods are not displayed in the interface. This tool will either have to examine the binaries, or figure it out at runtime. For me, this tool will have to do something similar to the following:
Get a list of all public methods for each class used by the project by examining the headers, then either step 2 or step 3
Get overridden private methods by examining binary files
a) Read the binary application + all the dynamic libraries that it refers to for a list of all the methods defined by each class used by the application.
b) Of these, methods not found in step 1 are private methods.
c) Go through the class hierarchy and define subclasses that override the private methods of superclasses
Get overridden private methods at runtime
a) Launch the application
b) Using the Objective-C runtime methods, we can get all the methods defined for all classes.
c) Again, methods not found in step 1 are private methods.
d) ,
- / , ( , NSManagedObject, Core Data). , , .
, , libclang, , otool nm, Objective-C runtime, , ?
. ; .