【发布时间】:2014-11-29 04:58:25
【问题描述】:
如何让应用程序名称在前台运行?它使用 SpringBoard 在 iOS 7 中工作,但在 iOS 8 中我没有得到结果。任何帮助表示赞赏。我不需要在 Apple Store 上提交我的应用,所以如果还有可用的补丁或脚本,请告诉我。
代码在 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 任何人都知道它应该有助于解决这个问题吗?
【问题讨论】:
-
我有同样的问题,我还没有得到解决方案
-
可能是 Apple 从 iOS 8 开始禁用此功能
-
看起来 FrontBoard 是一个私有框架。这不适用于应用商店应用。您可以将它用于自己使用的应用程序,或者用于越狱的应用程序,但如果您尝试使用这样的私有框架,您将被应用商店拒绝。
-
见 stackoverflow.com/questions/26161001/… 它被认为是一个漏洞,在 iOS 8 中被禁用。
-
希望有适用于 iOS8 和 iOS9 的解决方法
标签: ios objective-c iphone ios8 iphone-privateapi