iSimulate 自动挂钩
我想知道是否有人知道 iSimulate 如何自动注册/挂钩到已调试的 iDevice 应用程序中?它就像包含静态库(和几个框架)一样简单,并且可以正常工作。没有可调用的方法或函数。这怎么可能?
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 of frameworks) and it just works. There are no methods or functions to call. How is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的回答:使用 Objective-C 中的类别,您可以扩展或扩充系统中的任何类,包括核心类和 NSObject 本身。 (例如,类似于 Ruby 中的“猴子修补”。)
实际的通信很可能是广播,发送不期望得到答复的包。当您启动应用程序时,它只是开始拦截这些包。因此,模拟器应用程序挂接到 iSimulate 流中,而不是 iSimulate 以某种方式“进入”您的应用程序。
查看开源加速度计模拟器项目。您也可以轻松地将其扩展为广播触摸,并且基本上复制 iSimulate 的功能。您还将了解 Objective-C 的精彩一面。
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.