我不完全确定,但看起来下面的代码自上次ios更新后不再起作用了。 calculateDirectionsWithCompletionHandler永远不会回答:几小时后它仍然没有响应。
CLLocationCoordinate2D thisone;
thisone.latitude=49;
thisone.longitude=6;
MKPlacemark *pmfrom=[[MKPlacemark alloc]initWithCoordinate:thisone addressDictionary:nil];
MKMapItem *source=[[MKMapItem alloc]initWithPlacemark:pmfrom];
//6.9.0 [source autorelease];[pmfrom autorelease];
thisone.latitude=50;
thisone.longitude=7;
MKPlacemark *pmto=[[MKPlacemark alloc]initWithCoordinate:thisone addressDictionary:nil];
MKMapItem *destination=[[MKMapItem alloc]initWithPlacemark:pmto];
MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init];
request.source = source;
request.destination = destination;
request.requestsAlternateRoutes = YES;
request.departureDate=[NSDate date];
request.transportType=MKDirectionsTransportTypeAutomobile;
MKDirections *directions = [[MKDirections alloc] initWithRequest:request];
[directions calculateDirectionsWithCompletionHandler:
^(MKDirectionsResponse *response, NSError *error) {//XC not answering
NSLog(@"returned");
}];