Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to do the opposite of NSSelectorFromString()

In Cocoa, you can write @selector(mySelectorNameWithObject:) to get a compiled SEL, or at runtime, NSSelectorFromString(@"mySelectorNameWithObject:") with return a SEL. According to Apple documentation:

The only thing that makes the selector method name different from a plain string is that the compiler makes sure that selectors are unique.

But I can't seem to use a SEL object as a string without crashing. Is there a way to take a SEL and get back an NSString object? Basically I'm looking for the exact opposite of NSSelectorFromString().

Thanks in advance.

like image 979
codehearted Avatar asked Dec 13 '22 00:12

codehearted


1 Answers

Er…NSStringFromSelector?

like image 80
Chuck Avatar answered Feb 22 '23 16:02

Chuck