Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So I decided to use Apple Developer Technical Support to really clear this out. This is the reply:</p> <hr> <p>Hello,</p> <p>Thank you for your inquiry to Apple Worldwide Developer Technical Support. I am responding to let you know that I have received your request for technical assistance.</p> <p>The de-facto standard way of doing this is using the Map application. I realize this is not what you want. You want to stay within your app. The MKMapView API does not give you that level of support when it comes to user directions. You will have to rely on a separate web service to obtain those directions, then plot each lat/long point yourself on the MKMapView. Basically you will need to make an HTTP request to the Google Directions API. The terms require you to display the results on a Google map; since MKMapView shows Google, that should be OK.</p> <p><a href="http://code.google.com/apis/maps/documentation/directions/#DirectionsRequests" rel="nofollow">http://code.google.com/apis/maps/documentation/directions/#DirectionsRequests</a></p> <p>If you succeed in obtaining driving directions from let say Yahoo or Google service, MKMapView will allow you to plot a visual course using an MKOverlayPathView and MKShapes to draw polygon-like shapes. Apple has a sample called "KMLViewer" found at <a href="http://developer.apple.com/library/ios/#samplecode/KMLViewer/Introduction/Intro.html" rel="nofollow">http://developer.apple.com/library/ios/#samplecode/KMLViewer/Introduction/Intro.html</a> It shows you how to plot points based on KML. The approach is the same since we are dealing with lat/long coordinates.</p> <p>You may want to consider using the Map application, which would be considerably easier. All you need is this:</p> <pre><code>// for lat/long directions NSString *urlString1 = @"http://maps.google.com/maps?daddr=37.324885,-122.032378&amp;saddr=37.332094,-122.03124"; // for address directions NSString *urlString2 = @"http://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr=1+Infinite+Loop,+Cupertino,+CA+95014&amp;daddr=Mandarin+Gourmet,+Cupertino,+CA&amp;hl=en&amp;geocode=FcajOQIdYvO5-Ckbd16TtrWPgDFAc4Pi50E92A%3BFZ2GOQIdLe65-CHRv0sTH7YegykLqKn9rbWPgDGUnqKbIqi1Bg&amp;mra=ls&amp;sll=37.325567,-122.032989&amp;sspn=0.007243,0.007285&amp;ie=UTF8&amp;ll=37.328195,-122.031466&amp;spn=0.007243,0.007285&amp;z=17"; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: urlString1]]; </code></pre> <p>SECOND E-MAIL:</p> <p>Just to be clear in my last e-mail about the terms for using Google services. Google requires you to display the route results on a Google map, which MKMapView uses. However, I would double-check Apple's own T&amp;Cs regarding the use of external services like user directions on MKMapView itself. I don't want you do go down a path only to find legal restrictions along the way.</p> <hr>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload