There is no need for `while` loop here. According to the docs, `class_getInstanceMethod` will look into superclasses if the specified class does not contain a method with the specified selector.