gpt4 book ai didi

swift 3 错误 : Argument labels '(count:)' do not match any available overloads

转载 作者:行者123 更新时间:2023-11-28 15:53:58 25 4
gpt4 key购买 nike

它说有一个过载错误,虽然我不确定它为什么这么说......

   let value: UInt8 = 75
let sendData = (bytes: [value])
let data = Data(sendData: UnsafePointer<UInt8>(sendData), count: sendData.count)
mainPeripheral!.writeValue(data, for: writeCharacteristic!, type: writeType)

我希望通过 writeValue 发送值 75

最佳答案

在 Swift 3 中它更简单,因为 Data 符合 Sequence

let value : UInt8 = 75
let data = Data([value])
mainPeripheral!.writeValue(data, for: writeCharacteristic!, type: writeType)

关于 swift 3 错误 : Argument labels '(count:)' do not match any available overloads,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42009596/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com