我正在尝试从当前源绘制路径到目的地和方向完成处理程序,我收到错误
Domain = MKErrorDomain Code = 5“方向不可用”
我现在正在使用iOS 7。
这是我的代码
MKDirectionsRequest *DirectionRequest = [[MKDirectionsRequest alloc]init];
MKPlacemark *QiblaPlace = [[MKPlacemark alloc]initWithCoordinate:CLLocationCoordinate2DMake(21.4166667, 39.81666670000004) addressDictionary:nil];
[DirectionRequest setSource:[MKMapItem mapItemForCurrentLocation]];
[DirectionRequest setDestination:[[MKMapItem alloc] initWithPlacemark:QiblaPlace]];
DirectionRequest.transportType = MKDirectionsTransportTypeAutomobile;
DirectionRequest.requestsAlternateRoutes=YES;
MKDirections *direction = [[MKDirections alloc]initWithRequest:DirectionRequest];
[direction calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) {
if (error) {
NSLog(@"Error %@", error.description);
} else {
routeDetails = response.routes.lastObject;
for (MKRoute *route in response.routes) {
[_routeMapview addOverlay:routeDetails.polyline level:MKOverlayLevelAboveRoads];
}
}
}];
感谢您的帮助。