5

使用otool -tV SpringBoardServices命令,我可以在SpringBoardServices框架二进制文件中获取 C 函数。

我可以看到SBFrontmostApplicationDisplayIdentifier哪个会给我最重要的应用程序的 id。这个id可以用来获取UIApplication吗?最终我想获得消耗触摸事件的最顶层视图及其类型,如 UIButton 等?

任何帮助表示赞赏。

4

1 回答 1

3

This is not a real answer, but rather just some thoughts on this problem.

C vs Objective C API's

  • Generally speaking, there are two types of API's: C API's (like SBFrontmostApplicationDisplayIdentifier) and objective C API's.

  • I believe all of C API's just work with primitive types (strings, integers and so on). I didn't see any C API which returns Objective C object.

  • SBFrontmostApplicationDisplayIdentifier returns id (which is just a string). As example "com.apple.Preferences" for Preferences app.

  • I believe you will have better luck looking for Objective C API's which returns any kind of objects

Inter-process communication

  • There is no simple way to transfer object (especially complex objects pointing to other objects, which points to other objects and so on) between processes. If you think about it, UIApplication object can reference half of application. The only way is to serialize EVERYTHING on one end and deserialize on another end.

  • Taking into account problems related to serialization of objects, most of API which needs to do inter-process communication, pass simple structures with most critical information to each other. And I saw exactly this pattern while reverse engineering iOS binaries.

UIApplication

  • My guess that UIApplication objects never leaves a process space. Actually existence of SBApplication class (inherited from SBDisplay) in Springboard is kind-of indirect confirmation for this.

Ideas

  • Try to look at BackboardService

  • Try to review all API's in SpringboardService

  • I would try to haunt for anything related to Display.

P.S. I would love to see the solution, because I am not aware of any API's which gives visibility into 3rd party app UI.

于 2013-05-07T15:05:41.903 回答