【问题标题】:Ho do I get to know whether specific app is installed on user device?我如何知道用户设备上是否安装了特定的应用程序?
【发布时间】:2016-09-20 04:45:37
【问题描述】:
我的目标是为Google+、Pinterest 和LinkedIn 创建自定义UIActivities 用于社交分享。并且我的自定义活动应该出现在 UIActivityViewController 中,只有当原生应用不存在时(未安装 - 意味着原生共享不会出现在 UIActivityViewController 中)。
但我不知道如何检查这些应用程序是否已安装
这有什么可能吗?
【问题讨论】:
标签:
ios
objective-c
uiactivityviewcontroller
uiactivity
【解决方案1】:
您必须知道URL Scheme 才能通过canOpenURL 访问该应用,例如:
NSURL *likedInURL = [NSURL URLWithString:@"linkedin://profile?id=[id]"];
if ([[UIApplication sharedApplication] canOpenURL: likedInURL]) {
[[UIApplication sharedApplication] openURL: likedInURL];
} else {
// There is no app installed
}
查看更多方案:http://pureoxygenlabs.com/10-app-url-schemes-for-marketers/
希望对你有帮助。