我有以下问题。我使用下面的代码,我得到的问题
“Variable ‘characteristic’ was never mutated; consider changing to
‘let’ constant”
for var characteristic:CBCharacteristic in service.characteristics ?? [] { print(str) _selectedPeripheral!.writeValue(str.dataUsingEncoding(NSUTF8StringEncoding)!,forCharacteristic: characteristic,type: CBCharacteristicWriteType.WithoutResponse) }
当我改变为“let”时,有一个错误:
‘let’ pattern cannot appear nested in an already immutable context