views:

1129

answers:

1

Hello,

I'm trying to launch google maps from my iPhone application. The launching part works fine but since the iPhone 3.1 update (i think it was around this time) I get a zoomed out map of the US and Canada rather than zoomed in on my current location. Everything worked fine originally but sometime around the update things stopped working correctly.

Here is the string i've been using. This works on my partners phone with OS 3.0 and our iPod with os 2.2.1 but on my phone with OS 3.1 shows a zoomed out map of Canada and the US.

  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];

Any help is greatly appreciated. Thanks in advance.

+1  A: 

This is the code I use in one of my apps and it works fine with 3.1. The parameters for Google maps are documented here.

CLLocationCoordinate2D stationLocation = ...

NSString *urlString = [[NSString alloc]
     initWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&dirflg=d",
     curLocation.latitude,
     curLocation.longitude,
     stationLocation.latitude,
     stationLocation.longitude];

NSURL *aURL = [NSURL URLWithString:urlString];
[urlString release];
[[UIApplication sharedApplication] openURL:aURL];
progrmr
This doesn't give me what I need. Looks like this is used to give directions from one location to another. I'm looking for a search term around a given latitude and longitude.I noticed something funny. Using the following URL in a web browser gives me a zoomed in map of my location [urlString release]; [[UIApplication sharedApplication] openURL:aURL];Any ideas?
jmurphy
progrmr
Unfortunately this didn't work either. It seems like this is a 3.1 vs 3.0 problem because it works fine on my partners phone with 3.0.
jmurphy