次のif文をガードに変更します。そうすることで、次のエラーがスローされます 条件付きバインディングの初期化子には '(Bool、String)'ではなく、オプションの型が必要です どうすればいいと思いますか? 助けていただければ幸いです。あなたは?
(非別売)せずに変数を宣言しても、それをデフォルト値を与えられたのでuはエラーを得た理由をありがとうifステートメントをguardに変更すると、このエラーがスローされます。条件バインディングの初期化子には、(Bool、String)ではなく、オプションの型が必要です
dispatch_async(backgroundQueue, {
let (success, errmsg) = client.connect(timeout: 5)
print("Connected",success)
if success {
let (success, errmsg) = client.send(str: self.jsonString)
print("sent",success)
if success {
let data = client.read(ApplicationConfig.expectedByteLength)
if let d = data {
if let recievedMsg = String(bytes: d, encoding: NSUTF8StringEncoding){
print(recievedMsg)
let (success, errormsg) = client.close()
}
}
}else {
print("Message not sent", errmsg)
}
}
})
}