I pull the data into the table in the cellForRowAt method. Once the application has started and received all the data, restart it starts to receive and somehow cannot receive and crashes, restart again, it will receive something, there is no periodicity, it is always different

var sumExp = [Double]() func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! DataTableViewCell cell.backgroundColor = UIColor.clear cell.selectionStyle = UITableViewCellSelectionStyle.none var d = 0.0 var arr = [Double]() let query = PFQuery(className: "Expenses") query.whereKey("user", equalTo: (PFUser.current()?.objectId)!) query.whereKey("Trip", equalTo: tripCategory[indexPath.row]) query.findObjectsInBackground(block: { (objects, error) in // if error == nil { if let sums = objects { for object in sums { let sum = object["expensesSum"] as! Double let tripName = object["Trip"] as! String print("Название трипа \(tripName) и сумма \(sum)") //self.suum += sum d += sum } arr.append(d) self.sumExp.append(Double(arr.last!)) } } cell.summLabel.text = String(self.sumExp[indexPath.row].rounded(toPlaces: 2)) //print(sumExp[0]) }) 

    0