无法推断出通用参数S.
var buff:[Int8] = [Int8](repeating:0,count:16)
...
var addr = String(bytes: buff, encoding: String.Encoding.utf8)
答案 0 :(得分:3)
根据the documentation,buff
需要为S : Sequence, S.Iterator.Element == UInt8
的S类型。所以你需要它是一个UInt8的数组而不是Int8&#39>
import Foundation
var buff:[UInt8] = [UInt8](repeating:0,count:16)
var addr = String(bytes: buff, encoding: .utf8)