Code:
-(void)getRouteDirections{
MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init];
[request setSource:[MKMapItem mapItemForCurrentLocation]];
// It crashes on this line:
MKPlacemark * placemark = [[MKPlacemark alloc]initWithCoordinate:_location.coordinate];
}
Exception:
-[MKPlacemark initWithCoordinate:]: unrecognized selector sent to instance
It crashes only on iOS 9. How can I solve this problem?
Answer from Larme comments:
- (instancetype)initWithCoordinate:(CLLocationCoordinate2D)coordinate;
is available since iOS10.For iOS 9 or earlier,
initWithCoordinate:addressDictionary:
is available since iOS 3.