The app crashes at the line
class ImageValueCell: UITableViewCell, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var imagesList: UITableView! var imageArray: NSArray! override func awakeFromNib() { //super.awakeFromNib() // Initialization code imagesList.delegate = self; imagesList.dataSource = self; imageArray = NSArray() imagesList.reloadData() } func addImagesValue(objectList: NSMutableArray, machine: WIFIMachine){ imageArray = objectList imagesList.reloadData() //CRASHED HERE }
}
I trace through and found that imageList is nil when the crash happens. This is a custom cell with a UITableView created on the storyboard. Can anyone advise me on the possible solution that i could try?
If you are calling
addImagesValue
before theawakeFromNib
is called, then your code will empty the array. I don't think that is what you want. Here is a better solution: