Launch Google maps app from iPhone application.
Date : March 29 2020, 07:55 AM
may help you . 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];
|
Iphone: how to launch a route in google maps api from your application
Tag : iphone , By : user186876
Date : March 29 2020, 07:55 AM
hop of those help? I have read a lot of topics, but i don't find when i want , Try this UIApplication *app = [UIApplication sharedApplication];
NSURL *url = [[NSURL alloc] initWithString: @"http://maps.google.com/maps?saddr=41.029598,28.972985&daddr=41.033586,28.984546"];
[app openURL:url];
[url release];
|
Google Maps: Universal link format - destination coordinates - "Unsupported Link Google Maps can't open this link&q
Date : March 29 2020, 07:55 AM
seems to work fine I've just tried your second approach (with addingPercentEncoding(withAllowedCharacters:) and provided the given coordinate and got exactly the same error in Google Maps app. But then I changed coordinate to the one that is in my city and voila! it worked. Seems like google maps simply couldn't generate directions given the (-20.021999, 57.579075) pair. And judging by your second screenshot (with web version presented – it is blank, no map is presented) I think it's struggling with generating directions in your case too. Why does it tell that the link is not supported in such case puzzles me though. import UIKit
class ViewController: UIViewController {
override func loadView() {
super.loadView()
let lat = 51.150992
let long = 71.426444
let string = "https://www.google.com/maps/dir/?api=1&destination=\(lat),\(long)"
let encoded = string.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let url = URL(string: encoded)!
UIApplication.shared.open(url)
}
}
|
Help with google maps link for Iphone
Date : March 29 2020, 07:55 AM
|
iPhone HTML link to maps.google.com that opens page in Mobile Safari, not Maps App
Tag : ios , By : Gilmar Souza Jr.
Date : March 29 2020, 07:55 AM
|