ios - 使用 url 方案将标记添加到 ios 中的谷歌地图

标签 ios google-maps

当我在我的应用程序中点击“在 Google map 中打开”按钮时,我希望我的应用程序导航到谷歌地图应用程序并打开我指定的地址并在其中放置一个标记。

这是我为此目的编写的代码:

UIAlertAction* googleMaps = [UIAlertAction actionWithTitle:NSLocalizedString(@"google_maps", @"Google Maps") style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
    NSString *customURL = @"comgooglemaps://?center=41.039400,28.994583&zoom=16&markers=size:mid%7Ccolor:0xff0000%7Clabel:1%7CVodafone+Arena+Stadyumu";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
}];

当我点击按钮时,它会正确导航到特定位置。但是,它没有给它加上标记。有办法实现吗?

谢谢:)

最佳答案

根据 Google 文档,您的代码中指定的格式是错误的:-

例子:-

comgooglemaps://?q=Vodafone+Arena+Stadyumu&center=41.039400,28.994583&zoom=15&views=transit

这显示了 map 中心的标记

关于ios - 使用 url 方案将标记添加到 ios 中的谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35031374/

相关文章:

java - 使用来自服务器的图像作为谷歌地图android中的标记图钉

ios - 每个部分应该返回多少行?

ios - 使用 YouTube API 从 youtube 查询中排除受限视频

ios - Xcode 如何通过 Storyboard隐式设置 rootViewController?

ios - SwiftUI 中 $varName 和 _varName 有什么区别

iphone - 浮点函数返回值

java - 在 HttpRequestexecute() 上获取 NullPointerException 以将 POST 请求发送到 Google Places API

android - 谷歌地图上的准确路径

javascript - 我无法删除上次调用 map 绑定(bind)时创建的标记

Android 6.0.1 谷歌地图异常IllegalAccessError