I changed my core data model by adding an attribute to an entity. I've done a lightweight migration, but when I run the app I get a nil for some for the added attribute and thus a crash. I simply want to check for a nil and exclude the attribute if it is nil so as to avoid the crash. I've tried to do this with an if statement, but I get the error in the title. How can I get around this?
if comments == nil {
cell.textLabel!.text! = "\(totalWorkTimeInHours) hours"
cell.detailTextLabel!.text! = "Date: \(dateString)"
} else {
cell.textLabel!.text! = "\(totalWorkTimeInHours) hours"
cell.detailTextLabel!.text! = "Date: \(dateString)\nComments: \(comments)"
}
"Comments" is a string from Core Data. I know the error has something to do with the fact that I can't compare a string with nil, but I'm not sure how else to do it.
Thanks for the help!