SIGBRT in imagePickerController method. EXC_BAD_INSTRUCTION

So my issue has been that the viewWillAppear method in the DetialsViewController keeps trying to unwrap a nil Optional. This makes sense to me because it is trying to open an image that has not been set yet. When I try to open any of the detailviewcontrollers the app crashes every time.
My question is where do I put this code if it keeps breaking my app at this point?
This is my viewWillAppear.

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    
    nameField.text = item.name
    serialNumberField.text = item.serialNumber
    valueField.text = numberFormatter.string(from: NSNumber(value: item.valueInDollars))
    dateLabel.text = dateFormatter.string(from: item.dateCreated)
    
    //Get the item key
    let key = item.itemKey
    
    //If there is an associated image with the item
    //display it on the image view
    let imageToDisplay = imageStore.image(forKey: key)
    imageView.image = imageToDisplay
}

imageToDisplay is always nil at this point. Not sure how to fix this. I think I followed all the steps in the chapter too so I am not sure why this is happening.

EDIT: OK so the code I wrote up there is wrong but the example code changes the last two lines to:

if let imageToDisplay = imageStore.image(forKey: key) {
imageView.image = imageToDisplay
}

This now gives me a SIGBRT error in the imagePicker method when I select an image.

I realized that didn’t connect the code to the storyboard. Frustratingly I have made this mistake before and told myself to remember to check the connections first. I did not though.
If anyone is reading this because this error has caused you a headache be sure to the check the method’s connection to the storyboard.