0

I have a newbie question!

I have a problem coming back from a view pushed by a UITableView. Using viewWillAppear method to reload the modified data inside the second view, it crashes.

I will explain better.

I have my view A, contains a TableView, implements UITableViewDelegate, UITableViewDataSource, shows data correctly and everything works fine.

This view A is filled with an Array stored on the AppDelegate ( i don't know if is the best practice though ). When I click on an item inside the tableView on view A, view B is pushed to the navigationController. Inside View B I can edit, and delete the items. The problem is when I come back after a delete ( I didnt try it after an edit ), as I said I use the viewWillAppear method in View A. The application crashes with no error message ( stack... ) What makes me thing is something about the memory.

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    [self.itemsTable reloadData];
}

After the crash the item has been deleted correclty

I'm using core data BTW.

Any idea?

Mc-
  • 3,968
  • 10
  • 38
  • 61

1 Answers1

0

Ok the problem was the data had been reloading but I guess there was some kind of mismatch, since an item was deleted on the View B, The applciation was simply crashing.

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [ self fetchAllItems ];
    [self.itemsTable reloadData];
}

Fetching all the information again ( before reloading ) fixes the problem.

Mc-
  • 3,968
  • 10
  • 38
  • 61