1

Why NSClassFromString(@"Object") returns Object class?

When I try to ignore it using respondsToSelector: , i get

NSForwarding: warning: object 0x325ef24 of class 'Object' does not implement methodSignatureForSelector: -- trouble ahead

NSForwarding: warning: object 0x325ef24 of class 'Object' does not implement doesNotRecognizeSelector: -- abort

I can insert isEqualToString for skipping @"Object" string, but is it an issue or not?

Update:

"Object" is really a class. It have 5 possible selectors: initialize, retain, release, autorelease, class.

It can't be allocated.

AlKozin
  • 904
  • 8
  • 25

2 Answers2

1

For classes use instancesRespondToSelector:.

Rivera
  • 10,792
  • 3
  • 58
  • 102
-1

If You read documentation You can see that respondsToSelector: is using only with objects. And NSClassFromString returns You calss instead of object. I assume to solve Your issue You need to create object of received class.

HereTrix
  • 1,315
  • 7
  • 13
  • [Read this](http://stackoverflow.com/questions/1135366/class-method-equivalent-of-respondstoselector) Documentation not describes all possible methods. – AlKozin Oct 04 '13 at 06:20