I'm trying to create UIPickerView
programmatically and for this I did:
var pickerView = UIPickerView()
override func viewDidLoad() {
super.viewDidLoad()
self.pickerView.delegate = self
self.pickerView.dataSource = self
}
but I get really annoying errors according to threads as:
Main Thread Checker: UI API called on a background thread: -[UIPickerView init]
PID: 70649, TID: 6408323, Thread name: (none),
Queue name: NSOperationQueue 0x60000023ba20 (QOS: UNSPECIFIED), QoS: 0
It's really strange because it worked before and it started to appear exactly now!
I tried to change it as:
var pickerView: UIPickerView!
override func viewDidLoad() {
super.viewDidLoad()
Dispatch.main.async {
self.pickerView = UIPickerView()
self.pickerView.delegate = self
self.pickerView.dataSource = self
}
}
but I got crash again. Another error log was:
Assertion failure in void _UIPerformResizeOfTextViewForTextContainer(NSLayoutManager *, UIView<NSTextContainerView> *, NSTextContainer *, NSUInteger)(), /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIFoundation_Sim/UIFoundation-546.4/UIFoundation/TextSystem/NSLayoutManager_Private.m:1619
I'm spending my second hour in it and cannot realize what is the problem here. Can someone help me to understand?