iphone - 检查是否安装了应用程序

发布于 2024-11-26 11:59:33 字数 364 浏览 9 评论 0原文

我想提供我的 iPhone 中安装的应用程序的列表。

我听说这个代码示例在这个网站上,但我找不到它。

代码示例:检查是否安装了应用程序 - iDevKit: http://idevkit .com/forums/tutorials-code-samples-sdk/604-code-sample-check-if-app-installed.html

任何人都可以给我提示或如何从 网站?

谢谢。

I want to bring the list of what apps are installed in my iPhone.

I hear this code sample is in this website but I can't find it.

Code Sample: Check if an app is installed - iDevKit:
http://idevkit.com/forums/tutorials-code-samples-sdk/604-code-sample-check-if-app-installed.html

Can anyone give me a hint or how to get that code from the website?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半枫 2024-12-03 11:59:33

这在未越狱的 iOS 设备上是不可能的——应用程序沙箱会阻止它。如果您知道某些单独的应用程序实现的 URL 方案(例如,电话应用程序的 tel://),则可以通过调用 [[UIApplication shareApplication] canOpenURL:[NSURL URLWithString :@"someScheme://blah"]],但如果应用程序不响应任何 URL 方案,那么您将无法确定它是否存在于设备上。

This is not possible on non-jailbroken iOS devices—the app sandbox prevents it. You can test for some individual applications, if you know the URL schemes they implement (e.g. tel:// for the Phone app), by calling [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"someScheme://blah"]], but if an app doesn’t respond to any URL schemes then you’re not going to be able to determine whether it’s present on the device.

孤星 2024-12-03 11:59:33

在越狱设备上,您可以检查应用程序二进制文件:

-(BOOL)isWrightsCSInstalled
{
    return [[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/WrightsCS.app/WrightsCS"];
}

或者,如果您知道该应用程序具有自定义 URL 架构,您可以检查该 URL 是否可以打开:

- (BOOL) isTwitterInstalled 
{
    if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter://"]] )
        return YES;
    else
        return NO;
}

On a jailbroken device you can check against the apps binary:

-(BOOL)isWrightsCSInstalled
{
    return [[NSFileManager defaultManager] fileExistsAtPath:@"/Applications/WrightsCS.app/WrightsCS"];
}

Or, if you know the app has a custom URL Schema you can check if the URL can be opened:

- (BOOL) isTwitterInstalled 
{
    if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter://"]] )
        return YES;
    else
        return NO;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文