ios - 如何打开 Google map 点击 Xcode 中的嵌入 map

标签 ios xcode google-maps-sdk-ios

当我点击在 Xcode 中嵌入 google maps sdk 时,我正在尝试打开 Google map 应用程序。请帮助我找到解决方案?

最佳答案

在 .plist 文件“LSApplicationQueriesSchemes”中添加一个键并在其中提及一项“comgooglemaps”。

然后试试这个代码。

if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps:"]]) {
    NSURL *directionsURL = [NSURL URLWithString:@"comgooglemaps://"];
    [[UIApplication sharedApplication] openURL:directionsURL];
}
else{
    [[UIApplication sharedApplication] openURL:[NSURL
                                                URLWithString:@"https://itunes.apple.com/us/app/google-maps/id585027354?mt=8"]];
}

关于ios - 如何打开 Google map 点击 Xcode 中的嵌入 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35650358/

相关文章:

ios - 如何修复 Realm for swift 2.0 安装报错?

ios - SwiftUI TabView 中的图像未调整大小

ios - 我应该子类化还是使用类别

ios - 如何为 View 中的所有标签设置自定义字体?

ios - ios6中的MKMapView第一次崩溃

ios - 将搜索栏/按钮/任何东西放在谷歌地图 View 的顶部

Ios UIImageController 委托(delegate)未声明的错误

ios - 无法将 Carthage 框架链接到 Xcode 项目

ios - 使用动画更改 GMSCircle 半径

ios - 在适用于 iOS SDK 的 Google map 中显示 "my map"图层