We have a SDK that we ship via Cocoapods. It contains a map that makes some api calls and then renders custom annotations on the map. I’m running into an issue with MKAnnotationView when trying to integrate with a customer app.
At dev time and in our sample apps, the annotations appear correctly. When the customer tries to integrate it, the map annotations don’t work.
Has anyone ever seen this issue before? I'm not getting any error messages.
The relevant MKMapViewDelegate code is
public func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if let place = annotation as? Place {
os_log("Returning saved annotation", log: OSLog.map, type: .info)
return mapView.dequeueReusableAnnotationView(withIdentifier: PlacesAnnotationView.ReuseID) ??
PlacesAnnotationView(annotation: place, reuseIdentifier: PlacesAnnotationView.ReuseID)
}
os_log("Place was nil", log: OSLog.map, type: .error)
return nil
}
public func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
if let tileOverlay = overlay as? MKTileOverlay {
return MKTileOverlayRenderer(tileOverlay: tileOverlay)
}
return MKOverlayRenderer(overlay: overlay)
}
The ReuseID is in the format of OurName_PlacesAnnotation.
In viewDidLoad, I'm calling map.register(PlacesAnnotationView.self, forAnnotationViewWithReuseIdentifier: "placesViewReuseIdentitier").