the google maps API require parameters like this :
NSString *urlString=@"http://maps.google.com/maps?saddr=43.2923,5.45427&daddr=43.4697,5.65427";
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];
in that example i have gived directly values of longitude/latitude but when i try to it as variables like this :
float latStation=topStation.sstationLatitude;
float longStation=topStation.sstationLongitude;
NSString *urlString=@"http://maps.google.com/maps?saddr=43.2923,5.45427&daddr=latStation,longStation";
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];
this doesn’t work, how can i do please, thx in advance 🙂
You can use
stringWithFormat:like this:You might want to have a look at the String Programming Guide.