【问题标题】:"Current Location" on iPhone Maps.appiPhone Maps.app 上的“当前位置”
【发布时间】:2011-06-26 17:23:07
【问题描述】:

我正在使用此代码从我的应用程序运行 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];

【问题讨论】:

  • 你为什么不尝试在你的应用中展示一个 MapView 呢?
  • 因为我使用的是第 3 方 sdk,它只允许我使用 url。

标签: iphone api maps


【解决方案1】:

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

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

编辑:别忘了正确编码你的网址!

NSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

【讨论】:

  • 这不是我想要的,但它是唯一有效的!!(我说的是第一个)
猜你喜欢
  • 1970-01-01
  • 2011-11-21
  • 1970-01-01
  • 1970-01-01
  • 2021-03-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多