gpt4 book ai didi

ios - BindMemory 迁移 Swfit 3

转载 作者:可可西里 更新时间:2023-11-01 01:29:08 25 4
gpt4 key购买 nike

如何将此代码迁移到 Swift 3?

let keyBytes = keyData.bytes.bindMemory(to: Void.self, capacity: keyData.count)

我遇到了错误

'bytes' is unavailable: use withUnsafeBytes instead

最佳答案

keyDataData 对象的类型并且没有属性 bytes,将 keyData 转换为 NSData 然后访问 bytes

let keyBytes = NSData(data: keyData).bytes.bindMemory(to: Void.self, capacity: keyData.count)

关于ios - BindMemory 迁移 Swfit 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39870850/

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