Without changing anything in the view controller or updating to a new Xcode Version, displaying a UIAlertController doesn't work anymore.
Xcode gives me the error message: A constraint factory method was passed a nil layout anchor. This is not allowed, and may cause confusing exceptions. Break on BOOL _NSLayoutConstraintToNilAnchor(void) to debug. This will be logged only once. This may break in the future.
Now I successfully tried to debug it with the breakpoint given in the error message.
That's what I got:
Foundation`_NSLayoutConstraintToNilAnchor:
-> 0x1b51342ec <+0>: pacibsp
0x1b51342f0 <+4>: sub sp, sp, #0x30 ; =0x30
0x1b51342f4 <+8>: stp x20, x19, [sp, #0x10]
0x1b51342f8 <+12>: stp x29, x30, [sp, #0x20]
0x1b51342fc <+16>: add x29, sp, #0x20 ; =0x20
0x1b5134300 <+20>: adrp x19, 224497
0x1b5134304 <+24>: ldrb w8, [x19, #0xd30]
0x1b5134308 <+28>: tbnz w8, #0x0, 0x1b5134334 ; <+72>
0x1b513430c <+32>: adrp x8, 366
0x1b5134310 <+36>: add x8, x8, #0x30a ; =0x30a
0x1b5134314 <+40>: adrp x9, 196084
0x1b5134318 <+44>: add x9, x9, #0x2a8 ; =0x2a8
0x1b513431c <+48>: stp x9, x8, [sp]
0x1b5134320 <+52>: adrp x0, 196084
0x1b5134324 <+56>: add x0, x0, #0x288 ; =0x288
0x1b5134328 <+60>: bl 0x1b5105f6c ; NSLog
0x1b513432c <+64>: orr w8, wzr, #0x1
0x1b5134330 <+68>: strb w8, [x19, #0xd30]
0x1b5134334 <+72>: ldp x29, x30, [sp, #0x20]
0x1b5134338 <+76>: ldp x20, x19, [sp, #0x10]
0x1b513433c <+80>: add sp, sp, #0x30 ; =0x30
0x1b5134340 <+84>: retab
I have to admit, that this debugging is a bit out of my knowledge.
And that's my Code for displaying the Alert:
let vc = UIViewController()
pickerData = data
vc.preferredContentSize = CGSize(width: 250,height: 275)
let pickerView = UIPickerView(frame: CGRect(x: 0, y: 0, width: 250, height: 275))
pickerView.delegate = self
pickerView.dataSource = self
if let index = data.firstIndex(of: "Std.") {
pickerView.selectRow(index , inComponent: 0, animated: false)
}
vc.view.addSubview(pickerView)
let alert = UIAlertController(title: title, message: "", preferredStyle: UIAlertController.Style.alert)
alert.setValue(vc, forKey: "contentViewController")
let defaultAction = UIAlertAction(title: "Save", style: .default) {
(result : UIAlertAction) -> Void in
***
self.dismiss(animated: true)
}
alert.addAction(defaultAction)
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true)
The breakpoint stops obviously on the last line:
self.present(alert, animated: true)
What could be the error?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)