gpt4 book ai didi

ios - 使用纬度和经度用 pin 打开 iOS map

转载 作者:技术小花猫 更新时间:2023-10-29 11:18:51 26 4
gpt4 key购买 nike

我用这段代码打开 map 应用

NSString* versionNum = [[UIDevice currentDevice] systemVersion];
NSString *nativeMapScheme = @"maps.apple.com";
if ([versionNum compare:@"6.0" options:NSNumericSearch] == NSOrderedAscending){
nativeMapScheme = @"maps.google.com";
}
NSString* url = [NSString stringWithFormat:@"http://%@/maps?ll=%f,%f", nativeMapScheme, 40.739490, -73.991154];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

似乎效果不错,但我使用的这个位置没有引脚。如何添加pin,我想请求中有额外的参数?

最佳答案

如果您希望将图钉放置在 Apple 的 map 应用上,请在 URL 中使用“q”而不是“ll”。

你可以这样使用

 NSString* url = [NSString stringWithFormat:@"http://%@/maps?q=%f,%f", nativeMapScheme, 40.739490, -73.991154];

关于ios - 使用纬度和经度用 pin 打开 iOS map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19918921/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com