0
我收到以下錯誤這樣的說法:如何更新Swift 3的UnsafePointer數據聲明?
let data = Data(bytes: UnsafePointer<UInt8>(cubeData), count: cubeData.count * MemoryLayout<Float>.size)
cubeData被定義爲:var cubeData = [Float](repeating: 0, count: size * size * size * 4)
錯誤:
'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.
我該如何解決這個問題?
謝謝!
所以'cubeData'是'[Float]'? – kennytm
糟糕。我已更新我的問題 –