class ViewController: UIViewController {
override func viewDidLoad() {
// Do any additional setup after loading the view.
DispatchQueue.main.sync { //this line crashes with Thread 1 : EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
print("Rohit Kumar")
}
}
}
Getting crash with sync method in viewDidLoad but it is work with async, I don't know the reason behind this, can anyone help me in this.
I know the difference between sync and async.