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

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

我遇到错误了

“字节”不可用:改用withUnsafeBytes

最佳答案

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

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

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

10-11 17:16