当我在我的应用程序中点击“在 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¢er=41.039400,28.994583&zoom=15&views=transit
这显示了 map 中心的标记
关于ios - 使用 url 方案将标记添加到 ios 中的谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35031374/