获取当前正在运行的应用程序(第三方)捆绑标识符

Bit*_*ttu 15 iphone objective-c iphone-privateapi ios ios8

如何让应用程序名称在前台运行?它在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];
}
Run Code Online (Sandbox Code Playgroud)

另外我展示了新的框架FrontBoard谁知道它应该有助于摆脱这个问题?

its*_*rof 1

自从发现漏洞以来,iOS 8 中就无法再这样做了。后台应用程序可能会通过最前面的应用程序进行攻击。更多详细信息请参见:http://cve.mitre.org/cgi-bin/cvename.cgi ?name=CVE-2014-4361