簡體   English   中英

獲取當前正在運行的應用程序(第三方)捆綁標識符

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM