Jump to content

- - - - -

force refresh on return to view after updating Core Data elswhere in app...

view-controllers core-data web-services

  • Please log in to reply
1 reply to this topic

#1 markr


    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5

Posted 27 February 2014 - 10:34 AM

WOOPS - And, this is probably the same answer as what I found to solve soft-delete in http://sensiblecocoa...ddata#entry9521 - just need to figure out where to put it... Apologies for the redundant posts... --- Mark


Hi All -


I've got a SCTableViewController working with Core Data.  Elsewhere in my app, I've got a user action that does send/receive on content from a backend service.  New items inserted in Core Data by the send/receive are not appearing the SCTableViewController when the user returns to the SCTableViewController; however, they are present in Core Data.  Here's the process:


- launch the app

- navigate to the SCTableViewController

- add an item

- navigate to the other view with the send/receive button

- press send/receive

- verify using breakpoints, CoreDataPro and viewing content on the server that the new item was sent to the server AND that items were received from the server

- navigate back to the SCTableViewController


At this point the view looks just like it did when the user navigated away to do the send/receive.


I'm guessing I need to set a flag somewhere to "force refresh" on re-display.  But, I haven't found anything in the documentation about such a flag.


One other note - in the send/receive I'm using the same Core Data managed object context as for the SCTableViewController.  Also, at some future point - after rebuild(s) and/or closing/restarting the app - the received data does appear in the SCTableViewController - but this isn't clearly repeatable.


Thanks in advance for your help,


Edited by markr, 27 February 2014 - 11:09 AM.

#2 markr


    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 41 posts
Reputation: 5

Posted 27 February 2014 - 11:56 AM

Hi -


Answering my own question again...I added the following based on http://sensiblecocoa...ddata#entry9521 :


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.tableViewModel reloadBoundValues];
    [self.tableViewModel.tableView reloadData];


and the table now refreshes each time the view is displayed...


--- Mark

Also tagged with one or more of these keywords: view-controllers, core-data, web-services

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users