2

我已集成MapBox到我的应用程序中,并正在尝试使用MGLMapSnapshotter. 我直接从网站上复制了该功能。选项绘制的样式正确显示在地图上。谁能告诉我为什么它无法创建快照?

func createSnapshot(completion: @escaping (UIImage?) -> Void) {
    // Use the map's style, camera, size, and zoom level to set the snapshot's options.
    let options = MGLMapSnapshotOptions(styleURL: tripPhotosMap.styleURL, camera: tripPhotosMap.camera, size: tripPhotosMap.bounds.size)
    options.zoomLevel = tripPhotosMap.zoomLevel

    // Create the map snapshot.
    var snapshotter: MGLMapSnapshotter? = MGLMapSnapshotter(options: options)
    snapshotter?.start { (snapshot, error) in
        if error != nil {
            print("Unable to create a map snapshot.")
            print(error?.localizedDescription)
            completion(nil)
        } else if let snapshot = snapshot {
            // Add the map snapshot's image to the image view.
            completion(snapshot.image)
        }
        snapshotter = nil
    }
}

错误

{com.mapbox.mbgl.Map Snapshotter}[Style]: Failed to load sprite: HTTP status code 404
4

0 回答 0