22

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
aznelite89
  • 2,025
  • 4
  • 21
  • 32

3 Answers3

1

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

deathhorse
  • 637
  • 6
  • 15
  • Looks like the message has nothing to do with annotations. On my app, it shows up after a map.setRegion command, with or without annotations on the map. And playing with the map, more similar messages appear. – pw2 Nov 19 '20 at 11:14
1

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))

Eldar
  • 458
  • 3
  • 13
-9

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

Arco
  • 614
  • 5
  • 13