Questions tagged [mkdirection]

The MKDirections class obtain directions and route information from within an iOS device.

The MKDirections class obtain directions and route information from within an iOS device.

26 questions
2
votes
3 answers

Cannot wait for the result of MKDirections.calculate, getting nil instead of it

I would like to calculate the real walking distance between my current location and a list of CLLocations using MKDirections.calculate. However, for some reason the return command at the end of the function does not wait for the result and tries to…
2
votes
2 answers

Multiple Routes Between two Locations in Mkmapview

How to get one or more possible routes between two points? If anybody has worked on this can you please tell me?
Vikas Rajput
  • 1,754
  • 1
  • 14
  • 26
1
vote
1 answer

How can I execute code outside of my for loop (which needs to wait until the loop has finished retrieving data from Firebase Database)?

I am trying to show a table view which shows institutions by car travel times. The query loops through a list of schools in the database to retrieve their coordinates Calculate the distance from the user's current location If the distance is less…
Raf A
  • 179
  • 1
  • 12
1
vote
2 answers

Is there any restriction for number of requests in Mapkit and MKDirections?

I used Google Maps API https://maps.googleapis.com/maps/api/directions/json for drawing route and getting direction, but when its usees increases, we have to pay charges. I check in iOS and get that we use mapkit's MKDirections but I have a…
Mahesh
  • 956
  • 10
  • 17
1
vote
1 answer

How to get sequential MKDirection requests responses Swift

I have a function that takes a [CLLocation] as an input. Inside a while loop it splits it into chunks, for each chunk makes a MKDirection request, store the response in a new [CLLocation] and returns it once completed. The problem is that all the…
Vincenzo
  • 5,304
  • 5
  • 38
  • 96
1
vote
1 answer

Recursive Function, With Completion Block, That Retrieves Multiple MKDirections - Swift

I'm trying to retrieve an array of MKRoute that contains multiple routes all starting at the same place, but each having a different destination. The problem is that the only way I've been able to come up with to do this is through a recursive…
yambo
  • 1,388
  • 1
  • 15
  • 34
1
vote
1 answer

After deriving the driving distance between two points using MKDirections (Swift 4) how to access the distance value outside the closure?

I have written something like this to calculate the driving distance between 2 points / locations. Method Implementation: Class 1: static func calculateDistance(_ location1 : CLLocationCoordinate2D, location2: CLLocationCoordinate2D, completion:…
GeekyDeveloper
  • 141
  • 1
  • 6
1
vote
1 answer

How to draw a Route between CurrentLocation to SearchedLocation in MkMapView in Swift

I need current location as a source and searched location as a destination, but I got the current location but here I am unable to bring coordinates(latitude and longitude) from searched location to destination. here my destination shows nil…
Swift
  • 1,074
  • 12
  • 46
1
vote
0 answers

calculateDirectionsWithCompletionHandler not responding

I am not totally sure, but it looks like code below is not working anymore since the last ios update. the calculateDirectionsWithCompletionHandler is never answering: hours later it still hasnt responded. CLLocationCoordinate2D…
michaelsmith
  • 1,011
  • 1
  • 16
  • 35
0
votes
0 answers

Apple Map Shows small branches on route

I am drawing a line on map to make custom route between those points. SO for this I divide my coordinates array into chunks and make multiple calls for MKDirections. So i have multiple source and destinations to calculate route and add polylines on…
Rabia
  • 13
  • 1
  • 8
0
votes
1 answer

Multi request for distance via MKDirections

I'm coding an application that it use MapKit features. When I make request with for loop to get directions for many locations using MapKit's MKDirections , it gives error as "Directions is not available " with following details : Error…
U O
  • 29
  • 3
0
votes
1 answer

How do i initiate directions to pin annotations from user location when the user taps the pin?

I have a mkannotationview that generates my annotation points. I have set up user location permissions already so if the authorization is enabled, the user's location shows. I would now like for when a user clicks the pin, to generate the fastest…
DayoFade
  • 31
  • 1
  • 4
0
votes
1 answer

Directions from one location to another in swift using MapView

MapView Image with 2 TextfieldsHow to draw directions/route from one location to another entered in UITextfield using MapView in swift? The user should enter one location in source textfield and one location in destination textfield. Through the…
0
votes
1 answer

function returning array doesn't get the appends inside the for loop Swift

I'm new to requesting routes and following an article from hackingwithswift (https://www.hackingwithswift.com/example-code/location/how-to-find-directions-using-mkmapview-and-mkdirectionsrequest) I am able to get an alternative route to the route I…
Vincenzo
  • 5,304
  • 5
  • 38
  • 96
0
votes
1 answer

How can I stop the 'calculate' method of the 'MKDirections' class from making too many requests for distance calculation?

I am making requests for distance calculation from my current location to campsite locations in an array countySites using the calculate() method of the MKDirections class in a for loop. When I have an array of length 47 campsites only some of the…
user7142686
1
2