Creating a libsubstrate for iPhone Simulator

2019-07-24 15:20发布

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?

2条回答
叼着烟拽天下
2楼-- · 2019-07-24 15:40
smile是对你的礼貌
3楼-- · 2019-07-24 15:55

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.

查看更多
登录 后发表回答