方式1:
let bytes = [UInt8](data)
print(bytes)
复制代码
方式2:
let bytes = data.withUnsafeBytes {
[UInt8](UnsafeBufferPointer(start: $0, count: data.count))
}
print(bytes)
复制代码
方式1:
let bytes = [UInt8](data)
print(bytes)
复制代码
方式2:
let bytes = data.withUnsafeBytes {
[UInt8](UnsafeBufferPointer(start: $0, count: data.count))
}
print(bytes)
复制代码