-1

I uploaded an App to the AppStore on Monday. Everything worked fine. Since Thursday the Title of added Annotation is not visible anymore.

The App has an array of some Point of Interests. Each has a title and the coordinates. The PoI are showing and i can filter them for the title. But the title is not visible.

Preview current view

Preview on Monday

iSoldier
  • 31
  • 1
  • 4
  • 1
    Please show us some relevant code – Gerd Castan May 29 '21 at 18:37
  • `func createAnnotations(locations: [[String : Any]]) { for location in locations { let annotations = MKPointAnnotation() annotations.title = location["title"] as? String annotations.coordinate = CLLocationCoordinate2D(latitude: location["latitude"] as! CLLocationDegrees, longitude: location["longitude"] as! CLLocationDegrees) myMapView.addAnnotation(annotations) } }` – iSoldier May 29 '21 at 21:25

1 Answers1

0

I just fix it by adding the following function. Unfortunately it shows the title only by tabbing the pin.

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
    guard annotation is MKPointAnnotation else { return nil }

    let identifier = "Annotation"
    var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)

    if annotationView == nil {
        annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
        annotationView!.canShowCallout = true
        
        
    } else {
        annotationView!.annotation = annotation
    }

    return annotationView
}
iSoldier
  • 31
  • 1
  • 4