I am writing an RPC implementation with proxy objects (I think NSDistantObject). In this case, we generate header files (both DTO: s and protocols) directly from the server implementation. I dynamically create objects at runtime, but I ran into a specific problem.
When you come across an object, I have a name in the form of a string, and from there I will figure out what to do with it. My problem arises when I try to βrequestβ a system for a protocol that is not used anywhere in the code. The file header is, even #import: ed.
Some examples ...
This works great:
Protocol *protocol = NSProtocolFromString(@"UIApplicationDelegate");
If I take one of my own protocols and indicate that his delegate should match him, he also works without problems:
@interface ApplicationDelegate : NSObject <UIApplicationDelegate, ACMyCustomProtocol> {
}
Protocol *protocol = NSProtocolFromString(@"ACMyCustomProtocol");
, , nil:
Protocol *protocol = NSProtocolFromString(@"ACMyCustomProtocolNotMentionedAnywhere");
(, Xcode ) . Protocol *objc_getProtocol(const char *name) .
Edit:
, , , , , .
Objective-C :
, , ( ) arent, .