문제

My question differs than the other ones, because I am coding for a jailbroken environment. The method I am editing belongs to SpringBoard and creates a system wide change, on all apps. Using this command:

[[NSBundle mainBundle] bundleIdentifier]

Only brings SpringBoard, as this method belongs under SpringBoard. So is there a way to tell which app is active in front of SpringBoard?

도움이 되었습니까?

해결책 2

Things are way easier than what would one think. I found out that this brings the answer:

SBApplication *front = [[objc_getClass("SpringBoard") sharedApplication] _accessibilityFrontMostApplication];
NSString *runner = front.bundleIdentifier;

다른 팁

There is -(NSString*)topApplication method in BKSWorkspace class which returns bundle identifier of a top-most application. In order to get a valid instance of BKSWorkspace you need to hook it's -(id)init method to retain and store an instance for yourself. SpringBoard stores these instances in such a way that you can't access them without hooking init.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top