Private APIs without headers

A have a framework and an app.


To access the content (executable) of the framework I must use the headers in that framework. But in other environments like the Microsoft's .Net Framework, You can dynamically reflect (scan) DLLs to find out classes, methods, events and more.


So I think this way: .Net Framework is a "virtual" environment. The CLR links objects at runtime. It knows all the names of all the objects. I have read (and not one time) that the Objective-C Runtime also dynamicaly binds objects and knows the objects names. By "object names" I mean class names (NSString, NSLock...), method names (InitWithSomething...) and so on.


And so why can't my app link to frameworks directly without header files?


I could have the whole header file in a string and the Objective-C Runtime would have all the info that it needs. This way I could use Private APIs on iOS and Apple couldn't detect it.


If I'm wrong could someone please tell me where is the error.

Posted on Jul 8, 2011 8:50 AM

Reply
7 replies

Jul 9, 2011 6:49 AM in response to Paul Kasperskey

I don't know much about .Net and C#...but isn't it basically very "Java-like" in it's fundamental design? Whereas Obj-C basically brings Smalltalk-like OO into C (as opposed to the Simula67-like OO of C++).


What I'm getting at is, the fundamental mechanisms for dynamic binding and type reflection in the guts of the two run-time systems are probably very different - not to mention the differences in between mach-o and PE binaries and the compilers that generate them...


I think your issue may go beyond anything as simple as an equivalent method to scanning DLLs under .Net

Jul 10, 2011 2:13 PM in response to Paul Kasperskey

You can always call "performSelector" or create an NSInvocation. That is useful in some circumstances, even if you are calling a public API. It is not good for a private API because you have to guess at the parameters. Your guesses might not always be correct in every context. Plus, because the API isn't published, it could go away. That could cause your application to mysterious stop working one day years later.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Private APIs without headers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.