请不要在未阅读整个问题的情况下标记为重复
有没有办法在不显示地图的情况下获取iOS 中两点之间的行驶路线的长度?CLLocation
不是乌鸦飞的那样!!!但就像在 MK 驾驶模式下
我不能使用谷歌,因为我必须在谷歌地图上显示结果。
我找到了这段代码,但这仅在显示 iOS-Map 时有效:
-(void)showMapRouteFromCurrentLocation
{
CLLocationCoordinate2D currentUserCoordinate = YourCoordinate;
//currentUserCoordinate.latitude= +53.509980;
//currentUserCoordinate.longitude = -0.133700;
MKPlacemark *place = [[MKPlacemark alloc]
initWithCoordinate:currentUserCoordinate
addressDictionary:nil];
MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place];
NSDictionary *routeOption = [[NSDictionary alloc] initWithObjectsAndKeys:MKLaunchOptionsDirectionsModeDriving,MKLaunchOptionsDirectionsModeKey, nil];
[mapItem openInMapsWithLaunchOptions:routeOption];
}
但这不是我需要的。