开发者

iSimulate Automatic Hooks

开发者 https://www.devze.com 2022-12-22 05:05 出处:网络
I was wondering if anyone knew how iSimulate automatically registers/hooks itself into a debugged iDevice application? It\'s as simple as including the static library (and a couple 开发者_如何学JAVAof

I was wondering if anyone knew how iSimulate automatically registers/hooks itself into a debugged iDevice application? It's as simple as including the static library (and a couple 开发者_如何学JAVAof frameworks) and it just works. There are no methods or functions to call. How is this possible?


Short answer: using categories in Objective-C, you can extend or augment any class in the system, including core classes and NSObject itself. (Similar to "monkey patching" in Ruby for example.)

The actual communication is most likely a broadcast, sending packages that don't expect to get an answer back. When you start your app, it just starts intercepting these packages. So it's the simulator app that hooks into the iSimulate stream, rather than iSimulate somehow "reaching into" your app.

Have a look at the open source accelerometer simulator project. You could easily extend it to broadcast touches too, and basically duplicate what iSimulate does. And you learn about the nifty side of Objective-C.

0

精彩评论

暂无评论...
验证码 换一张
取 消