1

I launch the maps-App in my iPhone's App with the google-URL with the following code:

NSString *urlString = 
[NSString stringWithFormat:@"http://maps.google.com/maps?q=%@ %@&layer=t",   latitute.text,longitute.text];

NSString* encodedString =
[urlString stringByAddingPercentEscapesUsingEncoding:
 NSUTF8StringEncoding];

NSURL *aURL = [NSURL URLWithString:encodedString];


[[UIApplication sharedApplication] openURL:aURL];

With "layer=t" I will open the traffic-layer automatically. Using a Browser, maps showing the layer, in the maps-app not.

Has anyone have a solution for this problem?

Thanks.

Irfan
  • 4,301
  • 6
  • 29
  • 46
lightwave
  • 11
  • 2

1 Answers1

0

The browser and iOS url schemes are not necessarily the same, what you need is:

NSString *urlString = 
[NSString stringWithFormat:@"http://maps.google.com/maps?q=%@ %@&views=traffic", latitute.text, longitute.text];

For more information and parameters, you can checkout the Google documentation here: https://developers.google.com/maps/documentation/ios/urlscheme

Spaceship09
  • 341
  • 3
  • 8