在范围内找不到“ResourceOptions”

问题描述 投票:0回答:1

我正在尝试制作一个简单的mapbox地图iOS应用程序。我按照安装指南(三次检查 netrc 文件)并复制粘贴“显示简单的地图视图”示例。我收到错误“在范围内找不到‘ResourceOptions’”。

请参阅下面的代码...注意它是来自 Mapbox 的示例代码,不是我的...

import UIKit
import MapboxMaps

class ViewController: UIViewController {

    internal var mapView: MapView!

    override public func viewDidLoad() {
        super.viewDidLoad()

        // Create a map view.
        let myResourceOptions = ResourceOptions(accessToken: "your_public_access_token") //error here
        let myMapInitOptions = MapInitOptions(resourceOptions: myResourceOptions) //error here
        mapView = MapView(frame: view.bounds, mapInitOptions: myMapInitOptions)

        // Center the map camera over Stockholm.
        mapView.mapboxMap.setCamera(
            to: CameraOptions(
                center: CLLocationCoordinate2D(
                    latitude: 59.31,
                    longitude: 18.06
                ),
                zoom: 9.0
            )
        )

        // Add the map.
        self.view.addSubview(mapView)
    }
}

我已经完成了 Mapbox 提供的故障排除步骤(清理构建、缓存等),重新制作了整个简单的应用程序,阅读了文档,并尝试用谷歌搜索这个错误。显然,没有任何作用,谷歌也没有提供太多。请指教。

swift xcode mapbox mapbox-gl mapbox-ios
1个回答
0
投票

看来我的 github 版本错误。

© www.soinside.com 2019 - 2024. All rights reserved.