我正在 AWS 中部署一个无服务器 nodeJS 项目,该项目仅实现了一个 lambda 函数,该函数应返回 dynamoDB 表中的项目。 但是,当我运行命令时:
func showExamRoute(checkpoints: Array<Checkpoints>) {
// 1. Retrieve all checkpoints and add an annotation to them
// 2. Plot Poly-line to the corresponding checkpoints
let numberOfCheckpoints = checkpoints.count - 1
for index in 0...numberOfCheckpoints {
let checkpoint = checkpoints[index]
let checkpointLocation2D = CLLocationCoordinate2D(latitude: checkpoint.latitude, longitude: checkpoint.longitude)
checkpointsArray.append(checkpointLocation2D)
let annotation = CustomAnnotationPlace(title: "1", coordinate: checkpointLocation2D, info: "checkpoint")
mapView.addAnnotation(annotation)
}
let counterTo = checkpointsArray.count
var nextCheckpoint: CLLocationCoordinate2D!
var previousCheckpoint: CLLocationCoordinate2D!
for counter in 1...counterTo {
if counter == counterTo {
nextCheckpoint = checkpointsArray[0]
previousCheckpoint = checkpointsArray[counter - 1]
} else {
nextCheckpoint = checkpointsArray[counter]
previousCheckpoint = checkpointsArray[counter - 1]
}
print(nextCheckpoint, previousCheckpoint)
let destinationLocation = MKPlacemark(coordinate: nextCheckpoint)
let startingLocation = MKPlacemark(coordinate: previousCheckpoint)
let request = MKDirections.Request()
request.source = MKMapItem(placemark: startingLocation)
request.destination = MKMapItem(placemark: destinationLocation)
request.transportType = .automobile
request.requestsAlternateRoutes = false
let directions = MKDirections(request: request)
directions.calculate { [unowned self] (response, error) in
guard let response = response else { return }
let route = response.routes[0]
self.mapView.addOverlay(route.polyline)
self.mapView.setVisibleMapRect(route.polyline.boundingMapRect, animated: true)
let steps = route.steps
for i in 0...steps.count - 1 {
let step = steps[i]
print(step.instructions)
examSteps.append(step)
}
}
}
我收到以下错误:
我的项目在此链接中: enter link description here
问题出在 dev 分支上。
有人知道它可以是什么吗? 非常感谢您!
干杯,
马塞洛