calculateDirectionsWithCompletionHandler没有响应

时间:2016-10-10 06:45:36

标签: ios objective-c mkmapview mkplacemark mkdirection

我不完全确定,但看起来下面的代码自上次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");
 }];

0 个答案:

没有答案