我调用此方法将用户引导到 Apple Map 上。它在 iOS 6 上运行良好,但现在不能在 iOS 7 上运行。请问问题出在哪里?
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control{
lat1 = [[view annotation]coordinate].latitude;
lon1 = [[view annotation]coordinate].longitude;
NSString *str = [NSString stringWithFormat:@"http://maps.apple.com/maps?saddr=%f,%f&daddr=%f,%f", lat1,lon1,lat,lon];
NSURL *URL = [NSURL URLWithString:str];
[[UIApplication sharedApplication] openURL:URL];
}
更新
-(void)direct:(id)sender{
CLLocationCoordinate2D coordinate;
coordinate.latitude = 40.896056;
coordinate.longitude = 29.217947;
MKPlacemark *mPlacemark = [[[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil] autorelease];
MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:mPlacemark];
[mapItem openInMapsWithLaunchOptions:@{MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving}];
}