在 iPhone Maps.app 上获取“当前位置”

问题描述 投票:0回答:1

我正在使用此代码从我的应用程序运行maps.app。

NSString* urlStr = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", s_lat, s_long, d_lat, d_long];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:urlStr]];

问题是我无法获取当前位置。 我想要这样的东西:

 poi1.url = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=Current Location&daddr=%f,%f",lat,lon];
ios google-maps
1个回答
0
投票

您是否尝试过在位置数据后附加标签?

http://maps.google.com/maps?q=37.771008,+-122.41175+(You+can+insert+your+text+here)&iwloc=A&hl=en

编辑:不要忘记正确编码您的 URL!

NSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
© www.soinside.com 2019 - 2024. All rights reserved.