It would be better to use class_replaceMethod
BlueCocoa opened this issue · 0 comments
BlueCocoa commented
Line 86 in 2ca5bcd
If the class has overridden the -[WhateverClass forwardInvocation:]
method, then calling the class_addMethod
function will lead to fatal error. However, class_replaceMethod
will act like class_addMethod
if there isn't such -[WhateverClass forwardInvocation:]
method, or replace the method as expected if there is one.