何我知道用户设备上是否安装了特定的应用程序?
问题描述:
我的目标是为社交分享创建自定义UIActivities
,Google+
,Pinterest
和LinkedIn
。只有本机应用程序不存在(未安装 - 表示本地共享不会出现在UIActivityViewController中),我的自定义活动才会出现在UIActivityViewController
中。何我知道用户设备上是否安装了特定的应用程序?
但我不知道如何检查这些应用程序是否已安装 有没有这种可能性?
答
你必须知道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/
我希望这可以帮助你。