Added dispatch.async.. Should update text field.

This commit is contained in:
Alexander Munch-hansen 2017-08-01 00:51:28 +02:00
parent dc7848120c
commit 898cb3f65b

View File

@ -46,7 +46,12 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP
imagePickerController.dismiss(animated: true, completion: nil)
imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
}
func setTextInField(path: String) {
dcavTextField.text = path
}
@IBAction func onSaveButton(_ sender: Any) {
}
@ -76,8 +81,9 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP
}
self.responseString = String(data: data, encoding: .utf8)!
print("responseString = \(String(describing: self.responseString))")
self.dcavTextField.text = "https://dcav.pw/\(String(describing: self.labell.text![(self.labell.text!.startIndex)]))\(String(describing: self.responseString!))"
DispatchQueue.main.async() {
self.setTextInField(path: "https://dcav.pw/\(String(describing: self.labell.text![(self.labell.text!.startIndex)]))\(String(describing: self.responseString!))")
}
}
task.resume()