let queue = DispatchQueue(label: "queue")
queue.async {
let semaphore = DispatchSemaphore.init(value: 0)
let target = NetworkAPI.syncVehicleCert(password: self.passwordView.value, seid: self.boxNoView.value, step: STEP, typeId: TYPE_ID, vehicleData: jsonData)
NetworkManager<String>().request(target) { result in
if result.code == "10000" {
semaphore.signal()
} else {
semaphore.signal()
SVProgressHUD.showError(withStatus: result.info)
return
}
}
semaphore.wait()
let target2 = NetworkAPI.boxBind(password: self.passwordView.value, vin: "")
NetworkManager<String>().request(target2) { result in
if result.code == "10000" {
semaphore.signal()
SVProgressHUD.showSuccess(withStatus: "添加成功")
self.navigationController?.popViewController(animated: true)
} else {
SVProgressHUD.showError(withStatus: result.info)
return
}
}
semaphore.wait()
}
网友评论