Trying to refresh a TableView after FileSharing in AppDelegate

I have an app that has 3 different Storyboard Views with TableViews and Controllers. The Views are accessed through a TabBar Controller. The TableViews load data and present data from a Core Data store.

In my AppDelegate, I have added code that opens files with extensions my app recognizes. The code adds the contents of the files to a Core Data database.

I'm using AlertViews to ask the user if they would like to save the data.

All this is working quite well.

The problem I have is that when my app "becomes active" my initial TabBar View is presented and it presents a tableview of the data in the core database in it's original state. Then my AppDelegate file sharing code kicks in to read the file and add the data to the database ... but ...

... my initial View is not updated after the AlertView "Save" button is pushed and the data is updated to the Core Database. The AlertView message disappears and leaves the original view presented in its original state.

I've tried "reload" in various spots in the View's Controller ... nothing. I've tried switching tabs from the AppDelegate ... that kinda works but ...

I really want the View to update after the AlertView disappears and control returns to the View Controller.

Any thoughts?

thanks in advance!!

Answers


I believe you should be using a NSFetchedResultsController attached to the UITableViewController as it detects changes in the ManagedObjectContext (i.e. saves) and correctly updates the tableview. More info: NSFetchedResultsController

Cheers.


Need Your Help

Adding basic http authorization in a ajax json script

javascript ajax json basic-authentication

Not really sure how to add authentication in an ajax call for JSON information. I am trying to follow the examples given

Text box getting cleared beacause of update panel

c# html asp.net textbox updatepanel

I've have one table, in that table within one I've one and within that , I've update panel whose update mode is set to conditional. Within this update panel I've another table. The table contains 3...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.