Friday, April 17, 2026
HomeiOS Developmentswift - MKMapView will not show with iOS 14.4.2 - error Unsupported...

swift – MKMapView will not show with iOS 14.4.2 – error Unsupported use of UIKit

[ad_1]

MapView show working high quality in iOS 13.6.1. Switched to a different telephone with iOS 14.4.2. I get all types of errors:

[Assert] Can't be referred to as with asCopy = NO on non-main thread.
[Animation] +[UIView setAnimationsEnabled:] being referred to as from a background thread. Performing any operation from a background thread on UIView or a subclass just isn't supported and should end in surprising and insidious conduct. hint=(
    0   UIKitCore                           0x000000018a4d560c
...

As quickly as I hit the code beneath it provides extra errors:

Unsupported use of UIKit view-customization API off the principle thread

@IBOutlet weak var mapView: MKMapView! {
        didSet {
                self.mapView.mapType = .hybrid
                self.mapView.delegate = self
        }  
    }

Enclosed it in DispatchQueue

@IBOutlet weak var mapView: MKMapView! {
        didSet {
            DispatchQueue.primary.async {
                self.mapView.mapType = .hybrid
                self.mapView.delegate = self
            }
        }
    }

I additionally up to date all of the MKMapView code in DispatchQueue.primary.async {}
However error persists. I do not know methods to repair it?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments