Question

I am currently trying the Apple example Breadcrumb to track and draw a path where the user has been.

Having updated the base SDK to 7, it is alerting me that setNeedsDisplayInMapRect is deprecated as of iOS 7. I have looked in the reference documents and they advise that this should be replaced with MKOverlayRenderer.

As this is all new to me, I am struggling to fully grasp how to swap this around. Does anyone have any experience with this and can explain how to do so?

Was it helpful?

Solution

Change CrumPathView parent class to MKOverlayRenderer (available iOS 7.0 onwards) from MKOverlayView (deprecated on iOS 7.0) as both classes expose the same methods with couple of new extra methods introduced in MKOverlayRenderer.

Implement following MKMapViewDelegate's method (available in iOS 7.0 onwards) as a replacement for deprecated

// Deprecated in iOS 7.0
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay

// Method to replace above deprecated method (available in iOS 7.0)
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id < MKOverlay >)overlay
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top