Reputation: 85
I'm new to syncing data from iCloud so I have been using different tutorials to figure out how to upload my Core Data database to the iCloud. To do this I used a GitHub Source Code (https://github.com/mluisbrown/iCloudCoreDataStack). According to the Debug menu on Xcode 5 I am uploading Data to the iCloud and then it shows it is downloading however I see no data being returned, I think this is because I have nothing implemented in the -(void)storesDidChange:(NSNotification *)note
method. I have no clue how to put this data into practice. Please let me know if there is anything you need from me and I'll be happy to get it to you! Thank You!
Upvotes: 0
Views: 174
Reputation: 46718
This is a standard Core Data iCloud issue and is not impacted by the code you are using.
You need to consume that notification when it comes back. You do this with your main NSManagedObjectContext
using the method -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:]
. This will cause your NSManagedObjectContext
to tickle any NSFetchedResultsController
instances that you have.
Upvotes: 1
Reputation: 80265
I am also using PersistanceStack. In storesDidChange:
, I simply post a notification to the notification center. This is caught by any active view controller displaying any relevant data.
In the view controller I simply update the Interface, e.g. by performing a fetch on the fetched results controller and/or reloading a table view.
Upvotes: 1