iOS application crash when inspecting views with MapKit overlays

When you create a map view using MKMapView and add an overlay using MKOverlay, you might come across the unexpected crash from the hosting application while using Reveal to inspect the map view.

Problem

This problem is caused by an underlying issue in Xcode 12's Metal API validation setting. We have filed feedback with Apple reporting this issue (FB8813533), and will update this article when a fix is released.

Workarounds

If you are experiencing this issue, you can work around the problem by disabling Xcode's Metal API validation by following these steps:

  1. In your iOS project, go to Product → Scheme → Edit SchemeScreen_Shot_2020-10-20_at_12.09.05_pm.png
  2. Select the Run target
  3. Select the Diagnostics tab
  4. Ensure that Metal: API Validation checkbox is uncheckedScreen_Shot_2020-10-20_at_12.10.01_pm.png
  5. Re-run your iOS and inspect it using Reveal - your app should no longer crash.