in Education by
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)

1 Answer

0 votes
by
alert.setValue(vc, forKey: "contentViewController") This is definitely not a public api and can be broken at any moment (for example now). I recommend not to use it, since it can lead to application removing from AppStore. I recommending instead of hacking UIAlertController implement your own popup or use existing libraries.

Related questions

0 votes
    I'm trying to create a region in order to tell my Location Manager which beacon I care about. I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    So the idea is that users can create collections with many pairs of words in it. For example, they ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    This is my code it's just starting the scan but it is not completing ,where is the error in it. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    What is the best way to open a file as reading/write if it exists, or if it does not, then create it and ... to do the opening part. Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Heyy mates..Am an icse student can anyone tell me any importance for java please its urgent I have my exam ... please for icse java. Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    QTP doesn’t have any inbuilt support to connect to databases. Then, how can you connect to a database?...
asked Oct 19, 2020 in Technology by JackTerrance
0 votes
    Any one pls give me solved question papers of computer icse 2014-2018 Select the correct answer from above options...
asked Dec 23, 2021 in Education by JackTerrance
0 votes
    Give me some Information about Quantum Computer… Please…don’t copy from Google or any other sites… Don’t give me any irrelevant answer… Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    Why cooking food in an open vessel takes more time at a hill station ? Select the correct answer from above options...
asked Jan 4, 2022 in Education by JackTerrance
0 votes
    How do you suggest which evaluation metric is more important for any case? Select the correct answer from above options...
asked Nov 12, 2021 in Education by JackTerrance
0 votes
    Does independence of the judiciary mean that the judiciary is not accountable to any one? Write your answer in not more than 100 words. Please answer the above question....
asked Aug 4, 2022 in Education by JackTerrance
0 votes
    Which command tells ansible to run the playbook on all the hosts except host1? (i)ansible-playbook playbooks/ ... ansible-playbook playbooks/PLAYBOOK_NAME.yml -limit 'all:!host1'...
asked Jan 25, 2023 in Technology by JackTerrance
0 votes
    Whose body was most charming, being covered with the plentous beauty of the marks of hundreds of scars caused by ... king _______ . Select the correct answer from above options...
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    input: phrase 1, phrase 2 output: semantic similarity value (between 0 and 1), or the probability these ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 31, 2022 in Education by JackTerrance
0 votes
    _________ property tells the form how to transfer the data to the form processor. (1 Point) A. Method B. Action C. Both A and B Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
...