English 中文(简体)
页: 1 谷歌地图问题
原标题:iOS Google Maps Question

我已经审查了关于向谷歌地图应用发送用户的 Apple果文件(http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html),我有一个问题,即“我是否自动将用户目前地点的指示带到预定的排位/长地点?

The Apple Docs say to use "saddr=" and "daddr=" for the source and destination respectively, but it doesn t say how to acquire the user s current location. Is there some sort of keyword such as "saddr=Current" or "saddr=Here" that will get the user s location?

显然,这并不奏效:

[app openURL:[NSURL URLWithString:@"http://maps.google.com/maps?saddr=Here&daddr=Chicago"]];

如果我试图将用户送往芝加哥。 任何想法?

最佳回答

我认为,saddr=Current%20Location&daddr=......是你想要的。

问题回答

SOURCE: How to invoke iPhone Maps for Directions with Current Location as Start Address

你们需要利用核心位置来找到目前的位置,但随着时间的推移,你可以绘制地图,把你从那里前往街道地址。 与此类似:

CLLocationCoordinate2D currentLocation = [self getCurrentLocation];
   NSString* address = @"123 Main St., New York, NY, 10001";
   NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",
                    currentLocation.latitude, currentLocation.longitude,
                    [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
   [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];

我不认为你可以直接这样做。 但是,通过使用<代码>saddr=lat,long(例如addr=53.453209,-0.32930)的方式,您可将坐标划入参数。 因此,如果你向谷歌地图发送到你面前的用户目前的位置,你就获得了该功能的近似值。

你们只能使用目前加热器在ur中可悲的部分。 这一工作在SiOS进行,但我找不到安乐团的工作。

谷歌地图只用daddr para amount set,使谷歌地图自动在From现场插入用户目前的位置。

您总是能够利用SiOS的逆向地名录来获取现有地点地址(即用户让你获得其位置),并在URL中加以使用,网址是:是指用于扭转地理编码的类别。

- ——

NSString* directionsURL = [NSString stringWithFormat:@"http://maps.apple.com/?saddr=%f,%f&daddr=%f,%f",self.mapView.userLocation.coordinate.latitude, self.mapView.userLocation.coordinate.longitude, mapPoint.coordinate.latitude, mapPoint.coordinate.longitude];
if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString: directionsURL] options:@{} completionHandler:^(BOOL success) {}];
} else {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString: directionsURL]];
}




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签