[英]Get currently foreground running app (third party) bundle Identifier
如何让应用程序名称在前台运行? 它在iOS 7中使用SpringBoard,但在iOS 8中我没有得到结果。 任何帮助表示赞赏。 我不需要在苹果商店提交我的应用程序,所以如果还有任何补丁或脚本,请告诉我。
代码在iOS 8.0以下正常运行
- (NSMutableString*) getActiveApps
{
mach_port_t *port;
void *lib = dlopen(SBSERVPATH, RTLD_LAZY);
int (*SBSSpringBoardServerPort)() =
dlsym(lib, "SBSSpringBoardServerPort");
port = (mach_port_t *)SBSSpringBoardServerPort();
dlclose(lib);
//mach_port_t * port = [self getSpringBoardPort];
// open springboard lib
//void *lib = dlopen(SBSERVPATH, RTLD_LAZY);
// retrieve function SBFrontmostApplicationDisplayIdentifier
void *(*SBFrontmostApplicationDisplayIdentifier)(mach_port_t *port, char *result) =
dlsym(lib, "SBFrontmostApplicationDisplayIdentifier");
// reserve memory for name
char appId[256];
memset(appId, 0, sizeof(appId));
// retrieve front app name
SBFrontmostApplicationDisplayIdentifier(port, appId);
// close dynlib
dlclose(lib);
return [[NSString stringWithFormat:@"%s", appId] retain];
}
另外我展示了新的框架FrontBoard谁知道它应该有助于摆脱这个问题?
自从发现漏洞以来,iOS 8中无法再这样做了。 后台应用程序可能会攻击最前面的应用程序。 更多细节: http : //cve.mitre.org/cgi-bin/cvename.cgi?name = CVE-2014-4361
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.