Creating a libsubstrate for iPhone Simulator

2019-07-24 15:09发布

问题:

I am working on mobilesubstrate plugins on a JB iPhone. i have created a dylib in xcode for my iphone which builds fine for Device, but when i try to build it for Simulator, it gives me an error "_MSHOOKMESSAGE reference from: blah blah". I have placed all the headers in proper locations. I got libsubstrate from device but that is i think the problem. The libsubstrate from device is not gonna work for Simulator. So my question is how to create a libsubstrate for Simulator?

回答1:

If you simply need to use MSHookMessageEx (which superseded MSHookMessage), you can

#define MSHookMessageEx(class, selector, replacement, result) \
 (*(result) = method_setImplementation(class_getInstanceMethod((class), (selector)), (replacement)))

Of course, MSHookMessageEx in Mobile Substrate is more complex than this, but for testing purpose this is usually enough.



回答2:

http://www.ipodtouchfans.com/forums/showthread.php?t=103558 May be this can help you. Good luck.