BigBang icon indicating copy to clipboard operation
BigBang copied to clipboard

It would be better to use class_replaceMethod

Open BlueCocoa opened this issue 7 years ago • 0 comments

https://github.com/codesourse/BigBang/blob/2ca5bcd6fcd9fb2a0dc1d1f7da0f4b8558f00ebf/BigBang/BigBang.m#L86

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.

BlueCocoa avatar Aug 11 '17 12:08 BlueCocoa