Ch 14: Debugging a Fatal error: Unexpectedly found nil while unwrapping an Optional value

After finishing the steps up to page 350, when I run my code I get “Fatal error: Unexpectedly found nil while unwrapping an Optional value.” It’s highlighting " let label = cell.viewWithTag(1001) as! UILabel" in the newly changed configureCheckmark function as the source of the error. I went back through all of my code for ChecklistViewController.swift and ChecklistItem.swift and it matches the setup for when starting chapter 14 (except for the recent changes to this function). Where else should I look for the error? Do I need to setup an outlet for the new checkmark? I feel like I missed a step, but I triple checked the steps and couldn’t find one that I missed. (I’m using Edition 8 on Xcode 11.6)

Never mind, I figured it out. I must have accidentally wiped my View Tag from the Label in the Attributes Inspector and not noticed.

Hi @annenies and welcome to the community forum! Thank you for updating us and glad you were able to solve the issue! :smile:


This topic was automatically closed after 166 days. New replies are no longer allowed.