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.
Er…NSStringFromSelector
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With