Swift 如何修复调用中参数“completion”缺少的参数(MapBox场景工具包)

Swift 如何修复调用中参数“completion”缺少的参数(MapBox场景工具包),swift,swift4,mapbox,scenekit,Swift,Swift4,Mapbox,Scenekit,我正在编写一个应用程序,使用MapBox场景工具包查看AR中的位置。我在调用中不断得到参数“completion”的错误缺少参数,并且似乎没有任何地方记录该问题 我知道我在过去的2018年8月工作过的代码,因此我相信框架已经更新。如果任何人有任何建议,将不胜感激 if let terrainNode = terrainNode { terrainNode.scale = terrainNodeScale // Scale down map

我正在编写一个应用程序,使用MapBox场景工具包查看AR中的位置。我在调用中不断得到参数“completion”的错误缺少参数,并且似乎没有任何地方记录该问题

我知道我在过去的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
            })
        }

错误消息非常精确,并准确地告诉您需要做什么:向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
    }
)

非常感谢您的回复!你知道我为什么在调用中收到错误消息“放大”额外参数吗。我查看了所有sceneKit文档,似乎都是正确的。因为您所展示的代码中没有一个使用缩放参数,所以这一定是一个完全不同的问题,但同样,消息是准确的:您正在将缩放参数传递给一个不需要或不再需要此类参数的方法。