0

I now we can use contextIdAtPosition method to get context id of the front most application, but how can I use context id to get the bundle identifier of the front most application?Thank you!

Suge
  • 2,808
  • 3
  • 48
  • 79
  • @Surge: I get nil from [objc_getClass("CAWindowServer") serverIfRunning]? How were you able to make it work? Do you use any entitlements? I got jailbroken iOS 7 device on which I am trying. – TorukMakto Feb 24 '14 at 07:03

1 Answers1

1

If you only need the identifier of the front most app, you need to check out SpringBoard class.

@interface SBApplication : NSObject
-(NSString *)displayIdentifier;
@end

@interface SpringBoard : UIApplication
-(SBApplication *)_accessibilityFrontMostApplication;
@end
  • Thank you, and how can I get task port of `SpringBoard` as the method `taskPortOfContextId`? – Suge Feb 12 '14 at 07:07
  • I'm not sure what you are trying to do. If your tweak runs in `SpringBoard` then you can get the instance of `SpringBoard` by using `[UIApplication sharedApplication]`. –  Feb 12 '14 at 07:10
  • I want to make an `IOHIDSystemConnectionRef` to `SpringBoard`, which needs `task port` of `SpringBoard`, wen can use `contextIdAtPosition ` and `taskPortOfContextId` to get `task port` of the front most app, but how can we get the `task port` of `SpringBoard` when it's not at the home screen? – Suge Feb 12 '14 at 07:18
  • I don't know. But I think that should be asked as a separate question. It seems now you can get both identifier and task port of the front most app and this question is solved. –  Feb 12 '14 at 08:01
  • Thank you.Could you see this: http://stackoverflow.com/questions/21660397/how-to-get-task-port-of-springboard-in-ios7-jailbroken – Suge Feb 12 '14 at 08:03
  • Thanks for the link. I haven't made any related tweaks, just read some code of veency and am not familiar with that. –  Feb 12 '14 at 08:06