我试图从我的iPhone应用程序启动谷歌地图。从iPhone应用程序启动Google地图应用程序。
启动部分工作正常,但自从iPhone 3.1更新(我想这是在这个时间左右),我得到了一个缩小的美国和加拿大的地图,而不是放大我的当前位置。一切工作正常,但有时更新的东西停止正常工作。
这是我一直在使用的字符串。这适用于我的合作伙伴手机与iOS 3.0和我们的iPod与iOS 2.2.1,但我的手机与iOS 3.1显示一个缩小的加拿大和美国的地图。
NSString *name = @"clothing";
NSString *latlong = [[NSString alloc] initWithFormat:@"%@,%@", latitudeString, longitudeString];
NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?q=%@&mrt=yp&ll=%@",
[name stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
[latlong stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
[latlong release];
任何帮助,非常感谢。
在此先感谢。
什么在你的latitudeString和longitudeString?从显示的代码无法分辨。另外,latlong变量不是必需的,我不认为你需要在latlong字符串上使用stringByAddingPercentEscapesUsingEncoding,它应该只是一个浮点数。 – progrmr 2009-10-14 15:49:33
下面是我尝试过的最后一个字符串。 NSURL * aURL = [NSURL URLWithString:@“http://maps.google.com/maps?q=clothes&ll=45.505,-122.63&radius=30 &z=8"]; 我也试过以下字符串 NSURL * aURL。 = [NSURL URLWithString:@“http://maps.google.com/maps?q=liquor&z=13&sll=30.290525,-97.745706”]; NSURL * aURL = [NSURL URLWithString:@“http:// maps。 google.com/maps?q=liquor&ll=45.505,-122.63&mrt=yp&z=13“]; 谢谢 – jmurphy 2009-10-15 00:52:05