IconRenderer Warning in Xcode 11.2

Viewed 2792

I just created a new iOS Single View App and I try to build and run it. I had received the warning as below:

[Renderer] IconRenderer: HorizontalStretchPadding (18.000000, 18.000000) is larger than the image size (34.000000, 54.000000). Image will now use the center column of pixels to stretch.

This warning keeps showing multiple times.

3 Answers

I met with this warning, when I was programmatically selecting the MKMarkerAnnotationView in animated fashion.

I resolved my UI issues, by calling prepareForDisplay API on MKMarkerAnnotationView:


if #available(iOS 11.0, *) {
    let view = mapView.view(for: annotation)
    view?.prepareForDisplay()
}

Let me know if this helps.

Best, Boris

I thought about this warning for a long time, and after a while I found out what my problem was. When creating a map with the MapKit framework, the program returned this error depending on the values that were passed as latitudeDelta and longitudeDelta in MKCoordinateSpan. So, I just reduced these values, which brought the map closer, but the warnings stopped appearing. My working code is error-free:

import SwiftUI
import MapKit

struct MapView: View {
    var coordinate: CLLocationCoordinate2D
    
    @State private var region = MKCoordinateRegion()
    
    var body: some View {
        Map(coordinateRegion: $region).onAppear() {
            setRegion(coordinate)
        }
    }
    
    private func setRegion(_ coordinate: CLLocationCoordinate2D) {
        region = MKCoordinateRegion(center: coordinate, span: MKCoordinateSpan(latitudeDelta: 0.040, longitudeDelta: 0.040))
    }
}

struct MapView_Previews: PreviewProvider {
    static var previews: some View {
        MapView1(coordinate: CLLocationCoordinate2D(latitude: 55.7522200, longitude:  37.6155600))
    }

}

Before that, the values were as follows:: region = MKCoordinateRegion(center: coordinate, span: MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1))

I have the same problem with you in my MapView.

I just disable system log in my scheme, and my MKPointAnnotation also works.

OS_ACTIVITY_MODE: disable

enter image description here

Related