In my code I want to know if a method is a class method or an instance method. The code I am currently using works, but I wonder if there is a beter way.
Current code to "detect" if it is a class method or instance:
Method method = class_getInstanceMethod(class, selector);
if (method) {
__strong Class object = [[class alloc] init];
objc_msgSend(object, selector);
}else {
method = class_getClassMethod(class, selector);
if (method) {
objc_msgSend(class, selector);
}
}
objc_msgSendtoperformSelector:if you really want but there is no real sense to do so.