How to fix terminal output of "Style Z is requested for an invisible rect" when moving view on default iOS Map, using MapKit and SwiftUI, Xcode 12
Asked Answered
B

1

30

Using MapKit and SwiftUI (Version 12.0 beta 2 (12A6163b)) when zooming in/out around the map the terminal produces hundreds of these lines:

2020-07-21 21:05:39.310719-0500 MyApp[95733:4195994] [VKDefault] Style Z is requested for an invisible rect

import SwiftUI
import MapKit

@main
struct MapTest: App {
    var body: some Scene {
        WindowGroup {
            MapView()
        }
    }
}

struct MapView: View {
    var body: some View {
        Map()
    }
}

struct MapView_Previews: PreviewProvider {
    static var previews: some View {
        MapView()
    }
}

struct Map: UIViewRepresentable {
    func makeUIView(context: Context) -> MKMapView {
        
        let map = MKMapView()
        map.delegate = context.coordinator
        return map
    }
    
    func updateUIView(_ uiView: MKMapView, context: Context) {}

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }
    
    final class Coordinator: NSObject, MKMapViewDelegate {
        var control: Map
        
        init(_ control: Map) {
            self.control = control
        }
    }
}

How do I fix this?

Beseech answered 22/7, 2020 at 2:13 Comment(0)
P
1

This is a really common problem since Xcode 12.0, but for now the only solution seems to disable an Environment Variables called "OS_ACTIVITY_MODE".

You have to edit your Scheme, go to Run section, add another Environment Variables, call it "OS_ACTIVITY_MODE" and set "disable" as value.

This prevents messages on log console.

Providing answered 23/11, 2021 at 9:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.