I am getting the following error: initWithPolyline
: is deprecated: first deprecated in iOS 7.0
MKPolylineView *lineView = [[MKPolylineView alloc]
initWithPolyline:overlay];
What is the replacement method of instead of this ?
You should use (MKOverlayRenderer *)
type delegate instead of (MKOverlayView *)
type delegate. And return MKPolylineRenderer
instead of MKPolylineView
.
-(MKOverlayRenderer *)mapView:(MKMapView *)mapView
rendererForOverlay:(id<MKOverlay>)overlay {
MKPolylineRenderer *renderer = [[MKPolylineRenderer alloc] initWithOverlay:overlay];
renderer.strokeColor = [UIColor redColor];
renderer.lineWidth = 5.0;
return renderer;
}
See the documentation for initWithPolyline:
. Read the Deprecation Statement which says to use an MKPolylineRenderer
object instead.
You will like to take a look to MKPolylineRenderer, specifically to -initWithPolyline (avalilable in iOS 7 and later).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With