您好,我正在创建一个简单的 map 与一个圆形覆盖,每次我运行它在SIM卡上,我得到下面的警告.如果能帮我摆脱它,我将不胜感激.我试着用一种方法添加圆形覆盖,但警告仍然没有消失.当我对欧洲的一个位置进行地理编码时,我也得到了另一个代码(下面是第二个代码).我在谷歌上找不到关于这两个人的任何信息.

(2/2)个地面平铺缺少地面网格层的网格可渲染对象.平铺调试信息:(关键字:0.1.2.255 t:34 kt:0,具有网格错误:0,网格实例计数:2,挂起material 计数:2,不可见网格实例计数:0|关键字:1.1.2.255 t:34 kt:0,具有网格错误:0,网格实例计数:2,挂起material 计数:2,不可见网格实例计数:0)

找不到密钥欧洲中盾的配置包

import SwiftUI
import MapKit

struct MapView: UIViewRepresentable {
   @State private var coordinate = CLLocationCoordinate2DMake(45.5202471, -122.6741949)
   let city: String
   let state: String
   let country: String
   let is100: Bool

   func makeUIView(context: Context) -> MKMapView {
       let mapView = MKMapView()
       mapView.delegate = context.coordinator

       let geocoder = CLGeocoder()
       var address = "\(city), \(state), \(country)"
       if state.isEmpty {
           address = "\(city), \(country)"
       }
       geocoder.geocodeAddressString(address) { placemarks, error in
           if let placemark = placemarks?.first, let location = placemark.location {
               self.coordinate = location.coordinate
               mapView.setCenter(self.coordinate, animated: true)
               
               let region = MKCoordinateRegion(center: coordinate, latitudinalMeters: is100 ? 20000 : 10000, longitudinalMeters: is100 ? 20000 : 10000)
               mapView.setRegion(region, animated: true)

               let regionRadius = is100 ? 10000.0 : 3500.0
               let circle = MKCircle(center: coordinate, radius: regionRadius)
               mapView.addOverlay(circle)
           }
       }
       return mapView
   }

   func updateUIView(_ uiView: MKMapView, context: Context) {}

   func makeCoordinator() -> Coordinator {
       Coordinator()
   }

   class Coordinator: NSObject, MKMapViewDelegate {
       func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
           if let circle = overlay as? MKCircle {
               let circleRenderer = MKCircleRenderer(circle: circle)
               circleRenderer.strokeColor = UIColor.black
               circleRenderer.fillColor = UIColor.green.withAlphaComponent(0.5)
               circleRenderer.lineWidth = 1.0
               return circleRenderer
           }
           return MKOverlayRenderer(overlay: overlay)
       }
   }
}

推荐答案

MapKit framework可能无法为指定区域中的地砖找到所需的网格数据.

在您的情况下,错误的一个可能原因是区域太大:您将区域的宽度和高度设置为20000米,这是一个非常大的区域.MapKit框架可能没有足够的内存来加载此区域的所有网格数据.(如"Advanced MapKit Tutorial: Custom MapKit Tiles / Loading the Pre-rendered Tiles"所示)由Adam Rush.

试着缩小这个区域的大小.您还可以try 放大 map ,以便缩小区域.

I see also "No config pack found for key Europe Central Shields", which is also related to the mesh data for the ground tiles. The MapKit framework needs to download this data in order to render the ground tiles. However, the framework may not be able to find the data for the "Europe Central Shields" config pack.
You can try restarting your device. This should force the MapKit framework to download the latest data.

Ios相关问答推荐

我如何确保用户继续他们在应用程序中停止的地方?

在SWIFT中将圆角+透明背景从导入视频(.mp4)添加到导出视频(.mov)

如何在将EXPO更新到50.0后修复react 本机错误

为什么AVSpeechSynthesizer复制的信息比我的文本多?

swiftui 图像放大时无法正确拖动

如何制作支持不同语言的iOS应用

更新 flutter 和 xcode 后 Xcode 14.3 中缺少文件 (libarclite_iphoneos.a)

Toast 不显示 Flutter

SKScene 的更新功能似乎不起作用

CoreML 不能并发(多线程)工作?

SwiftUI:同时拖动父视图和子视图,但手指分开

通过 Rosetta 打开模拟器 xcode 14 以修复滚动

使用 RxDatasources 作为数据源时如何填充自定义页眉/页脚视图

SwiftUI 视图 - viewDidLoad()?

Xcode 项目格式:3.1、3.2、6.3 和 8.0 有什么区别?

在 iOS 7 上更改标签栏色调 colored颜色

每个版本的 iOS 都附带什么版本的移动 Safari?

SLComposeViewController 分享教程

如何在 Objective-C 中组合两个数组?

使用 Chrome DevTools 调试 iOS 6+7 Mobile Safari