Mapbox未加载街道和详细信息:无法加载mapbox://mapbox.mapbox-streets-v6

时间:2015-08-07 10:20:44

标签: ios swift maps mapbox

刚刚通过cocoapods安装了MapboxGL。 我在我的ViewController中初始化它,如给出的示例:

 @IBOutlet weak var mapViewWrapper: UIView!

    var mapView: MGLMapView!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Map
        let styleURL = NSURL(string: "asset://styles/dark-v7.json")
        mapView = MGLMapView(frame: mapViewWrapper.bounds, styleURL: styleURL)
        mapView.autoresizingMask = .FlexibleWidth | .FlexibleHeight

        // set the map's center coordinate
        mapView.setCenterCoordinate(CLLocationCoordinate2D(latitude: 38.894368,
            longitude: -77.036487),
            zoomLevel: 15, animated: false)
        mapViewWrapper.addSubview(mapView)

    }

当我启动应用程序时,我看到一个黑色方块和一个Mapbox徽标但没有街道,请参见下图 enter image description here

在日志中我得到了这个:

[ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.mapbox-streets-v6]: 
[ERROR] {Map}[Style]: Failed to load [mapbox://mapbox.mapbox-terrain-v2]: 

任何想法我做错了什么?

2 个答案:

答案 0 :(得分:1)

感谢您报告此on GitHub,非常感谢。要在此处关闭循环,出现此问题是因为Mapbox iOS SDK不恰当地缓存了使用错误访问令牌发出的请求,而这些请求往往会产生类似连接问题的模糊错误。

this在v3.1中修复。

答案 1 :(得分:0)

这可能是间歇性的网络或API问题?用法看起来正确。