Closed IngwiePhoenix closed 9 years ago
Unlike Obj-C, oj doesn't have a concept of looking up strings from classes/selectors and vice versa at runtime. oj.class_getName
and oj.sel_getName
exist, but they are for logging/debugging purposes only and will return a short name when --squeeze
is enabled.
Hence, it's best to pass in a Class rather than a String. For example, here's what our ApplicationMain() looks like:
function ApplicationMain(cls) {
var app = [UIApplication sharedInstance];
var delegate = [[cls alloc] init];
[app setDelegate:delegate];
[app _launch];
global.sApp = app;
}
ApplicationMain([AppDelegate class]);
Copy that. I copied the approach into my own app. Thanks! :)
I am working on restructuring my code a little and wanted to implement something similar to
NSApplicationMain
. But I realized I would need to create a class from a string. How do I do that in OJ?I.e.:
Kind regards, Ingwie.