-3

use the PrivateFrameworks SpringBoardServices is not work in iOS8,iOS9, I can get background all process but which is running in foreground?

(void) monitoringFrontApp {
mach_port_t *port;
void *uikit = dlopen(SPRINGBOARDPATH, RTLD_LAZY);
int (*SBSSpringBoardServerPort)() =
dlsym(uikit, "SBSSpringBoardServerPort");
port =  (mach_port_t *)SBSSpringBoardServerPort();

//dynamic link sys mothed
void* (*SBFrontmostApplicationDisplayIdentifier)(mach_port_t* port,char * result) =
dlsym(uikit, "SBFrontmostApplicationDisplayIdentifier");
//call mothed
char frontmostAppS[256];
memset(frontmostAppS,sizeof(frontmostAppS),0);
SBFrontmostApplicationDisplayIdentifier(port,frontmostAppS);
NSString * app_id = [NSString stringWithUTF8String:frontmostAppS];

NSLog(@"front display app Identifier----%@", app_id);

//dynamic link sys mothed
CFStringRef (*SBSCopyLocalizedApplicationNameForDisplayIdentifier)(CFStringRef displayIdentifier) =
dlsym(uikit, "SBSCopyLocalizedApplicationNameForDisplayIdentifier");
//call mothed
CFStringRef locName = SBSCopyLocalizedApplicationNameForDisplayIdentifier((__bridge  CFStringRef)app_id);
NSString *app_name = [NSString stringWithFormat:@"%@",locName];
if (locName != NULL)CFRelease(locName);

 NSLog(@"front display app name----%@", app_name);

}

not work in iOS8 and iOS9

KUANGKAI
  • 1
  • 1
  • please add some code – Jigar Apr 20 '16 at 03:36
  • Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace"); NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)]; NSLog(@"apps: %@", [workspace performSelector:@selector(allApplications)]); – KUANGKAI Apr 20 '16 at 03:39
  • http://stackoverflow.com/questions/25926026/how-to-monitoring-app-running-in-the-foreground-in-ios8-use-the-privateframework/36637872#36637872 – KUANGKAI Apr 20 '16 at 03:44
  • @KUANGKAI Update your question, don't put code in comments. – rmaddy Apr 20 '16 at 03:52

1 Answers1

0

Google analytics will help you for tracing. https://www.google.co.in/analytics/#?modal_active=none

Dheeraj Kumar
  • 490
  • 3
  • 12