【发布时间】:2019-01-07 08:04:58
【问题描述】:
我正在尝试在我的 iOS 应用程序中通过谷歌地球打开 KMZ 文件。我可以打开谷歌地球应用程序,但无法在该应用程序中打开 KMZ 文件。 用于从我的应用程序打开谷歌地球的代码是
let KMZurl = Bundle.main.url(forResource: "oma", withExtension:"kmz")
let urlstring = "comgoogleearthz://url=\(KMZurl!)"
let Url = NSURL(string: urlstring)
if UIApplication.shared.canOpenURL(Url! as URL)
{
UIApplication.shared.openURL(Url! as URL)
} else {
//redirect to safari because the user doesn't have google earth
UIApplication.shared.openURL(NSURL(string: "https://www.google.com/earth/")! as URL)
}
如果有人这样做,请帮助我。如果这是不可能的,请告诉我。我坚持了2天。我也找不到任何文档。 TIA
【问题讨论】:
标签: ios swift google-earth kmz