MKMapView 在初始化时崩溃

时间:2021-03-24 23:41:42

标签: ios swift xcode mapkit mkmapview

enter image description here

GeoServices: -[GEOResourceManager pathForResourceWithName:fallbackBundle:fallbackNameHandler:] + 352

我遇到了上述崩溃。我正在使用 MKMapView() 初始值设定项。

    class MapCell: UICollectionViewCell {
    
          private let mapView  = MKMapView()
    
    
      override init(frame: CGRect) {
          super.init(frame:frame)
    
        self.mapView.mapType = .standard
        self.mapView.isScrollEnabled = false
        self.mapView.isZoomEnabled = false
        self.mapView.isPitchEnabled = false
        self.mapView.isRotateEnabled = false
        self.contentView.addSubview(self.mapView)
    
    
      }


      override final func layoutSubviews() {
        super.layoutSubviews()

          self.mapView.frame = CGRect(x: 8, y: 8, width: 240, height: 240)
      }

    }

1 个答案:

答案 0 :(得分:1)

我认为崩溃的最可能原因是您的应用程序引用了一个资源,该资源未作为构建过程的一部分复制到应用程序包中。您能否放置一条调试语句来显示 GEOResourceManager 中引用的 URL,并检查构建的 IPA 文件以了解传递了哪些文件(假设它是 GEOResourceManager 中使用的文件 URL)。