2021年1月18日星期一

convert coordinates to address to have UIActivityViewController specify in Lyft/Uber apps

at the moment, my code just pulls up the acitvity controller but it is blank (no apps or actions) so i cannot confirm if it is working otherwise. Also I do not know how to handle error exception for this.

        let directionRequest = MKDirections.Request()          let destinationPlacemark = MKPlacemark(placemark: currentPlacemark!)          directionRequest.requestsAlternateRoutes = true                    directionRequest.source = MKMapItem.forCurrentLocation()          directionRequest.destination = MKMapItem(placemark: destinationPlacemark)                    let address = CLGeocoder.init()          address.reverseGeocodeLocation(CLLocation.init(latitude: destinationPlacemark.coordinate.latitude, longitude:destinationPlacemark.coordinate.longitude)) { (places, error) in                  if error == nil{                      if let place = places{                          //don't know what to do here                      }                  }              }                    let activityCotroller = UIActivityViewController(activityItems: [address], applicationActivities: nil)          activityCotroller.popoverPresentationController?.sourceView = self.view          self.present(activityCotroller, animated: true, completion: nil)  
https://stackoverflow.com/questions/65784973/convert-coordinates-to-address-to-have-uiactivityviewcontroller-specify-in-lyft January 19, 2021 at 11:06AM

没有评论:

发表评论