[英]How to monitoring App running in the foreground in iOS8 or iOS9
use the PrivateFrameworks SpringBoardServices is not work in iOS8,iOS9, I can get background all process but which is running in foreground?使用 PrivateFrameworks SpringBoardServices 在 iOS8、iOS9 中不起作用,我可以获取后台所有进程但哪个在前台运行?
(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不适用于 iOS8 和 iOS9
Google analytics will help you for tracing.谷歌分析将帮助您进行追踪。 https://www.google.co.in/analytics/#?modal_active=none
https://www.google.co.in/analytics/#?modal_active=none
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.