如何修复调用中参数 'completion' 丢失的参数(MapBox Scene Kit)

How to fix missing argument for parameter 'completion' in call (MapBox Scene Kit)

我正在编写一个应用程序来使用 MapBox 场景套件在 AR 中查看位置。我一直收到错误 "Missing argument for parameter 'completion' in call" 并且似乎没有任何地方记录这个问题。

我知道我过去(2018 年 8 月)使用过的代码,所以我相信框架已经更新。如果有人有任何建议,将不胜感激。

        if let terrainNode = terrainNode {
            terrainNode.scale = terrainNodeScale // Scale down map
            terrainNode.position = SCNVector3Make(0, -0.15, 0) // Place map slightly below clouds
            terrainNode.geometry?.materials = defaultMaterials() // Add default materials
            scene.rootNode.addChildNode(terrainNode)

            terrainNode.fetchTerrainHeights(minWallHeight: 100.0, enableDynamicShadows: true, progress: { progress, total in
            }, completion: {_ in
                NSLog("Terrain load complete")
            })

            terrainNode.fetchTerrainTexture(type, progress: { progress, total in
                self.progressView?.progress = progress
                NSLog("Texture load complete")
                terrainNode.geometry?.materials[4].diffuse.contents = image
            })
        }

enter image description here

错误消息非常准确,并准确告诉您需要做什么:将 completion 参数添加到 fetchTerrainTexture 调用中,如下所示:

terrainNode.fetchTerrainTexture(
    type, 
    progress: { progress, total in
        self.progressView?.progress = progress
        NSLog("Texture load complete")
        terrainNode.geometry?.materials[4].diffuse.contents = image 
    },
    completion: { image, fetchError in
        // whatever needs to be done on completion
    }
)