【发布时间】:2014-01-17 08:54:22
【问题描述】:
如果 iPhone 中未启用 gps,我必须从我的应用程序中打开设置应用程序。我使用了以下代码。它在 iOS 模拟器中运行良好,但在 iPhone 中无法运行。我可以知道这段代码有什么问题吗?
if (![CLLocationManager locationServicesEnabled]) {
int (*openApp)(CFStringRef, Boolean);
void *hndl = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices");
openApp = (int(*)(CFStringRef, Boolean)) dlsym(hndl, "SBSLaunchApplicationWithIdentifier");
openApp(CFSTR("com.apple.Preferences"), FALSE);
dlclose(hndl);
}
【问题讨论】:
-
这是非法的,请在越狱设备中尝试。 Apple 从 iOS 5 + 中删除了此功能
-
我认为路径可能与 sim 和 device 不同。这个应用会被提交到 appStore 吗?