ios - Mapbox iOS SDK 动态样式坐标边界崩溃

标签 ios swift crash mapbox bounding-box

我正在尝试处理 Mapbox 示例中的水彩栅格图层示例,并根据文档添加额外的边界框参数。该应用程序总是因 NSException 而崩溃,并且没有进一步的见解。

  func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
    let bounds = MGLCoordinateBounds(sw: CLLocationCoordinate2D(latitude: -180, longitude: -85.05112877980659), ne: CLLocationCoordinate2D(latitude: 180, longitude: 85.0511287798066))
    let source = MGLRasterTileSource(identifier: "stamen-watercolor", tileURLTemplates: ["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"], options: [ .tileSize: 256, .coordinateBounds: bounds])
    let rasterLayer = MGLRasterStyleLayer(identifier: "stamen-watercolor", source: source)

    style.addSource(source)
    style.addLayer(rasterLayer) }

是否不支持此选项参数?还是我做错了什么?

最佳答案

发现问题不是将边界添加为 NSValue,而是将它们添加为 MGLCoordinateBounds。

关于ios - Mapbox iOS SDK 动态样式坐标边界崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52670638/

相关文章:

iphone - 如何向上移动 tableView 以便从底部弹出一个 View ,使其不在 iPhone 的表格顶部

objective-c - 如何定义一个 NSArray?

ios - 以编程方式关闭标记的信息窗口 google maps iOS

ios - 如何更改 iOS 中 JTCalenderView 的工作日顺序?

ios - 即使在应用程序属性中设置了标志“位置”,CLLocationManager也会停止在后台更新位置

swift - 角脉冲

swift - 您能否验证用户最近是否已在 Firebase (Swift) 上进行了身份验证?

sql - (PL/SQL) 创建新数据库时崩溃

ios - xcode发生崩溃时如何继续调试

android - 捕获或检测 ANR 异常