DmitrievichR DmitrievichR - 6 months ago 63
iOS Question

When I try to make reloadData() I get a crash

When I try to reload tableview I get an error like

libc++abi.dylib: terminating with uncaught exception of type NSException


class NewTableViewController: UITableViewController {

var videos = [Video]()
didSet {

self.tableView.reloadData() //error here
let URL = ""

override func viewDidLoad() {

let request = Alamofire.request(.GET, self.URL)
request.responseObject { (response: Response<NewestVideos, NSError>) in

switch response.result {
case .Success(let newest):
self.videos = newest.videos!
case .Failure(let error):
print("Request failed with error: \(error)")

override func didReceiveMemoryWarning() {super.didReceiveMemoryWarning()}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {return self.videos.count}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! NewTableViewCell
let video = videos[indexPath.row]
cell.newVideoNameLabel?.text = video.completeUrl != nil ? video.completeUrl! : "nil"
return cell

I think it's problem with threading?
In my app I make a .get request and I get a value if I try to print in

I tried adding

dispatch_async(dispatch_get_main_queue()) {


The libc++abi.dylib: terminating with uncaught exception of type NSException error, happens from any ways.

  • Remove reference from outlet
  • Bad name in performSegueWithIdentifier
  • IBActions type.

Check this link for more info