Here I could get the closest one, tinker with a few hours. It includes the use of a mach_override fork, a couple of DYLD quirks regarding boot order, and a stomach for crazy hacks.
It will work only on the simulator, but this should be enough for the use case you use (I, of course, hope that you have no dependencies only on the device).
Soft code looks something like this:
#include <objc/runtime.h>
Which is surprisingly simple and produces a conclusion as follows:
Exchange implementations of the method description and custom_description.
There is no good way (without using a breakpoint and viewing the stack trace) to figure out which class is swizzled, but for most things, just looking at the selector should give you a hint about where to go from there.
It seems to work with several categories that I created that swizzle during +load , and from my reading of the internal mach_override and DYLD elements, if you have your library load order configured correctly, you can expect this to be initialized before any other user-earth code if you put it in your own dynamic library.
Now I can not guarantee the safety of this, but it seems to me useful to use the debugging tool, so I posted my example on github:
https://github.com/richardjrossiii/mach_override_example
It MIT is licensed, so feel free to use as you please.
Richard J. Ross III
source share