Reputation: 11
Background: I have created an iPad database (using core data) and now I am working on giving this database the ability to upload/download to DropBox. I followed all of the steps listed on the DropBox website and I can successfully upload to DropBox and download from DropBox.
Issue: After the file has downloaded from DropBox (called "dataBase.sqlite") my app does not update to display the data from the downloaded file. However, if I close the app by double tapping the HOME button and then restart the app, all of the data is now being displayed properly.
I would like to have the data update/display on my iPad after the download is complete without having to shutdown and restart the app. Any suggestion would be greatly appreciated.
Tried: [managedObjectContext reset];
and tried:
managedObjectContext=nil;
managedObjectModel=nil;
persistentStoreCoordinator=nil;
I am using the following: XCode 4.4.1 Mountain Lion 10.8 DropBox SDK
Upvotes: 0
Views: 326
Reputation: 11
Finally got this working by doing the following:
thx
Upvotes: 1
Reputation: 941
Your question puzzles me.
You seem to be reasoning from a WPF mindset including data binding. Reset your datasource (which is not a core date object like nsmanagedobject), but the object set at table.datasource
You seem to assume that the table gets his data from the managedObjectContext directly. Either that is a feature in iOs that I don't know, or you are cutting a major corner.
You are responsible for implementing an object complying with the UITableviewDatasource that knows where to get the data (your managedObjectContext most likely) and makes this available to the UITableView.
after said download from Dropbox, minimally you need to send a reload to your UITableview
[table reloadData];
Most likely you need to let your datasource object know as well, that it needs to "refetch" the data. (optionally this is a live connection, that updates on every accesss).
Upvotes: 0
Reputation: 677
You may have already tried this, but once you've detected that a new version of the database file has been downloaded, and after you've processed it into your Core Data structure, did you remember to [tableView reloadData]
?
Upvotes: 0