【发布时间】:2019-04-02 22:13:22
【问题描述】:
我的方法必须在用户连接时打印用户名,但错误 withUnsafeBytes is deprecated: use withUnsafeBytes(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R instead pops向上。
方法:
func joinChat(username: String) {
let data = "iam:\(username)".data(using: .ascii)!
self.username = username
_ = data.withUnsafeBytes { outputStream.write($0, maxLength: data.count) } //deprecated
}
有人知道怎么解决吗?
【问题讨论】:
标签: swift