Objective c Cocoa,存储类以调用类方法

Objective c Cocoa,存储类以调用类方法,objective-c,cocoa,Objective C,Cocoa,我想存储并设置一个类变量,以便调用它的类方法 是smth。像这样可能吗 Class classInstance = [someInstance class]; [classInstance callSomeClassMethod]; // declared with +, like + (void)callSomeClassMethod 是的,这是可能的 Class klass = [NSString class]; NSLog(@"%@", [[klass alloc] initWith

我想存储并设置一个类变量,以便调用它的类方法

是smth。像这样可能吗

Class classInstance = [someInstance class];

[classInstance callSomeClassMethod]; // declared with +, like + (void)callSomeClassMethod
是的,这是可能的

Class klass = [NSString class];

NSLog(@"%@", [[klass alloc] initWithUTF8String:"hey"]);

//=> 2012-07-26 17:29:56.882 Untitled 4[4061:707] hey

考虑到您已经编写了上面的代码,您是否想过只运行它,看看会发生什么?但似乎无法处理核心数据项?请详细说明哪些不起作用?