2

I am changing the title of the annotation inside of the mapView didSelect function:

override public func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView)

and this has been causing a lot of issues with callouts randomly appearing and not dismissing in the iOS 12 Beta. It works perfectly in previous iOS versions. Has anyone else encountered this issue or know what the problem is? I have attached a screenshot of the behavior.

Callout Issues

rdd
  • 21
  • 2
  • 1
    It looks like bug. You can file bug report here: https://bugreport.apple.com/ – Kosuke Ogawa Aug 02 '18 at 02:20
  • I encountered similiar issues (unable to dismiss callouts, multiple ones opening etc.) beginning with the iOS 12 beta. As a workaround I moved layout of everything related to the callout out of the `mapView(_:didSelect:)` you quoted above and into the `mapView(_:viewFor:)` method, where the annotation view is created. This solved my issues. I would recommend doing as little as possible in the `mapView(_:didSelect:)`. – vlz Sep 13 '18 at 15:19

1 Answers1

0

We have the same issue. Still the same behavior in iOS 12.1. As a workaround, like vlz mentioned, do the view setup completely in the mapView(_:viewFor:) method. I’ve made the experience that expensive logic which only needs to be triggered upon pin selection can still be done in didSelect, unless you don’t do heavy view changes in there (updating a label seems ok, while setting leftView for example breaks everything).

Sascha
  • 93
  • 5