Is there a way to get a class by name?
问题 In Objective-C, is there a way to get a class and send messages to it when you have the name of the class as a string? For example, is there a function func where func(@"NSString") == [NSString class] ? The reason that I want to know this is I am building a dynamic linker library for a language I am working on, and I want it to have an interface to Objective-C libraries. 回答1: Yes — two, in fact. If you have a Foundation-type framework (e.g. from Cocoa, Cocoa Touch or GNUstep), you can use the