views:

220

answers:

2

If Apple doesn't want developers using private APIs in the iPhone SDK, why don't they do something like mark the classes and/or methods with whatever the Objective-C equivalent of C#'s "internal" keyword? If the APIs are spread amongst multiple binaries, Apple could refactor them into dedicated private-API-only binaries to make this easier for them.

+4  A: 

Objective-C doesn't have an equivalent for the C#'s "internal" or Java's "final" keywords. I think it's to do with the dynamic nature of the language, that any such functionality would be too easily worked around anyway.

Also regarding the iPhone SDK, all the libraries need to be statically compiled into the aplication, no dynamic linking allowed. So setting a function as "internal" would make no difference in visibility even if it was possible.

tjohns20
A: 

Short answer, they don't mark them as private because they don't describe them at all.

Messages you aren't supposed to send don't appear in the corresponding .h files in the SDKs.

Private APIs are typically found by people using tools like class-dump against the binary frameworks, not by reading headers.

Jeff