Re:Apple Claims Mogenerator's Methods
by chrisdevereux on Sunday April 13, 2014 @08:21PM
(#7583817)
Well, the objects they really don't want you using (that grant access to resources with no public API) are often exposed as shared instances via class methods. This is actually the case with PhotoLibraryServices, the framework with these private methods[1].
In general, I agree with what you're saying. My point here is really just this approach to detecting private API usage is obviously going to throw up loads of false positives. I get that they'd rather have false positives than false negatives, but it doesn't make it any less annoying.
[1] https://github.com/JaviSoto/iOS7-Runtime-Headers/blob/master...
Apple is also (and probably most) worried about you messing with objects borrowed from/exposed by Cocoa, so looking for calls to [Class alloc] is not enough.
> I could obsfucate my access of the class, but equally I could obsfucate obtaining the selector.
The problem is that after compilation every call is obfuscated. Compilation throws away types, so all you're left with is tons of identical function calls with generic pointers pointing to `isa` structures that aren't definitive at compile time. I imagine this is really hard to statically analyze, especially that you can easily "launder" origin of objects by passing them through containers like NSArray, notifications, etc.