Can't get my head around this crash?

I was following the code for CheckList and I get this… It’s not breakpoint crash like mentioned in the tutorial so Im not sure? Similar sort of thing happened with the BullsEye app but I just ignored it. I don’t want to ignore this one!

Any help appreciated! Thanks :slight_smile:

P.S. Sorry if this has already been brought up, I’m new here so couldn’t find anything.

cell.viewWithTag(100) will return nil if a view with a tag of 100 isn’t found. If it is nil, the forced conversion (as!) to UILabel will fail with a runtime error. So, check if the label’s tag is set; if so, is set to what you are expecting?

Hey Mabco, thanks for your response!

After reading what you said and found the issue which I see was a simple mistake… On the storyboard I had the tag as 1000 instead of 100 so I changed the code accordingly.

Thanks for your help!

Glad to help. I would not call the use of tags to identify views to be a good practice, but I realize that’s how this tutorial does it. One problem is that it can be hard to keep track of what tag ID’s you’ve used, especially when setting them in the storyboard. If, for example, you inadvertently set two view’s tags to 1000, I believe it would be indeterminate which one is chosen. Sure, you would likely figure it out if you tested your app well, but there is a better way to do this without tags, and that is to create a custom cell and hook up your outlets within that custom cell class. Probably deeper than you want to go right now, but just be careful with using tags to identify your subviews.