5

using otool -tV SpringBoardServices command, I am able to get C functions in SpringBoardServices framework binary..

I can see SBFrontmostApplicationDisplayIdentifier which will give me id of the foremost app. Can this id be used to get UIApplication? Ultimately I want to get topmost view which is consuming touch events and its type like UIButton etc?

Any help appreciated.

Mani
  • 17,549
  • 13
  • 79
  • 100
TorukMakto
  • 2,066
  • 2
  • 24
  • 38

1 Answers1

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.

Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
  • Hi Victor - Have you ever used GSEventRegisterEventCallBack? Can that be helpful to get a event when a view gets added or removed? I know this is slightly vague question but I couldn't get GSEventRegisterEventCallBack working so asking if you have used it? – TorukMakto May 13 '13 at 14:12
  • I didn't use it. And I would say it's really interesting direction of research. I added information which I found for 10-15 minutes of reverse engineering in separate question which you wrote. Also, are you testing it on a real device or Simulator? – Victor Ronin May 13 '13 at 21:26