Objective-C protocol static method?
objective-c, protocols, static
Solution
[[handlerInstance class] getValue];
Yes, like this.
Unlike Java and C++, class methods can only be sent to the class.
Problem
I have a protocol in Objective-C, something like this: ``` @protocol Handler +(NSString*) getValue; @end ``` So now say I have an instance that inherits this protocol and I want to call this method: ``` [handlerInstance getValue]; ``` This gives a warning because the `getValue` method is not an instance method. How can I properly call this method from my instance? (Without knowing the concrete class)? I'm guessing something like this, but I'm not exactly sure: ``` [[handlerInstance class] getValue]; ```