ios - Using MKDirections to get Map Directions and Routes not working -


i trying provide user navigation direction click of button. reason doesn't seem working.

@ibaction func directiontodestination(sender: anyobject) {         getdirections()     }      func getdirections(){         let request = mkdirectionsrequest()         let destination = mkplacemark(coordinate: cllocationcoordinate2dmake(place.latitude, place.longitude), addressdictionary: nil)         request.setsource(mkmapitem.mapitemforcurrentlocation())         request.setdestination(mkmapitem(placemark: destination))         request.transporttype = mkdirectionstransporttype.automobile         var directions = mkdirections(request: request)         directions.calculatedirectionswithcompletionhandler({(response:             mkdirectionsresponse!, error: nserror!) in              if error != nil {                 // handle error             } else {                 self.showroute(response)             }          })     }          func showroute(response: mkdirectionsresponse) {             route in response.routes as! [mkroute] {                  placemap.addoverlay(route.polyline,level: mkoverlaylevel.aboveroads)                 step in route.steps {                     println(step.instructions)                 }             }     }              func mapview(mapview: mkmapview!, rendererforoverlay                 overlay: mkoverlay!) -> mkoverlayrenderer! {                     let renderer = mkpolylinerenderer(overlay: overlay)                      renderer.strokecolor = uicolor.bluecolor()                     renderer.linewidth = 5.0                     return renderer             } 

here how viewdidload() looks

manager = cllocationmanager()         manager.delegate = self         manager.requestwheninuseauthorization()         placemap.delegate = self 

can please point doing wrong sample code in swift ?

i don't know if added 2 required strings plist project.

 nslocationwheninuseusagedescription  nslocationalwaysusagedescription 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -