就像我们在Facebook应用程序中使用它来打开URL一样。我想在海雀浏览器中打开网址。
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://profile/355356557838717"]];
}
else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.facebook.com/DanielStormApps"]];
}
let urlPath: String = "puffin://www.facebook.com"
let url: NSURL = NSURL(string: urlPath)!
let isInstalled = UIApplication.sharedApplication().canOpenURL(url)
if isInstalled {
print("Installed")
}else{
print(" Not Installed")
}
您可以使用"puffin://"在http中打开URL。或者使用"puffins://"在 https 中打开网址。
添加信息列表文件
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fb</string>
</array>
您正在打开该类型网址:[NSURL URLWithString:@"fb://profile/355356557838717"]