Entire project code (so far) is uploaded to https://github.com/mikeyj777/MyFavoriteMovie/tree/master/MyFavoriteMovies
I'm unsure where I'm deviating from the code in the "recipe" lecture. however, when the program is in the tableviewcell class (FavMovieCell.swift), running "configureCell" method, the following line
lblTitle.text = movieRecord.title
throws an error.
before executing the line, I confirmed that movieRecord.title is populated:
(lldb) po movieRecord.title
▿ Optional("Out of Africa")
- Some : "Out of Africa"
When the line is executed, here is the error:
fatal error: unexpectedly found nil while unwrapping an Optional value
it would seem the error is stating that movieRecord.title is unwrapped as nil. However, I can see it has a value.
Any advice on what is causing this error, please let me know.
Here is the code for the tableviewcell class throwing the error:
class FavMovieCell: UITableViewCell {
@IBOutlet weak var imgMovie: UIImageView!
@IBOutlet weak var lblTitle: UILabel!
@IBOutlet weak var lblDescr: UILabel!
@IBOutlet weak var lblLink: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
func configureCell(movieRecord:FavMovie) {
lblTitle.text = movieRecord.title
lblDescr.text = movieRecord.descrWhyGood
lblLink.text = movieRecord.linkImdb
imgMovie.image = movieRecord.getImg()
}
}