0

There are several apps that I use on my Mac that store their data in core data. I can see the data I want in CoreDataPro. I want that data - specifically I want to send changes in that to some remote end points (such as Zapier, or some other REST service).

I was thinking of piggybacking something like RestKit - such that I provide a configuration file saying where the app is and what end points the data needs sending to. I need only to scrape the data and send to REST, not a two-way sync.

I'd prefer a utility that I could configure rather than having to code a Mac application.

I noted http://nshipster.com/core-data-libraries-and-utilities/ - RestKit still seemed the most capable, but in https://github.com/RestKit/RestKit/issues/1748 I was advised that coredata projects should only be opened by a single application at a time, and really RestKit is designed for baking into the source app (rather than for database scraping and sending).

What approach would you take?

I also noted: http://www.raywenderlich.com/15916/how-to-synchronize-core-data-with-a-web-service-part-1

Thanks, Martin.

Martin Cleaver
  • 909
  • 8
  • 21

3 Answers3

1

First, Core Data is an object store in memory. What is written to disk from Core Data can be in one of several formats. One of those formats happens to be SQLite. If the application is writing to SQLite then it is possible to sample that same file and push it somewhere else.

However, each application will have its own data structure so you would need to be flexible in the structure you are handling.

RestKit has no value in this situation as you are just translating objects into JSON and pushing them to a server. The built in frameworks do that just fine.

There is no utility to do this at this time. You would need to write it yourself or hire someone to write it.

If I were going to do something like this, I would write it using Core Data itself interrogate the model from the application that wrote the data in the first place and then translate the database into JSON and push it. You won't be able to tell what is new vs. old so the server will need to sort that out.

Another option, since you can't diff anyway, is to just push the sqlite file to the server and let the server parse through it.

Marcus S. Zarra
  • 46,571
  • 9
  • 101
  • 182
  • Ah, thanks for the clarity re: persistence and your other points about RestKit. Also your point about pushing the SQLite database gave me several other ideas! (which I've posted as potential answers, below) – Martin Cleaver Jan 15 '14 at 16:22
0

I'm wondering whether a good answer (where good excludes Objective-C and includes languages that I do know, such as - to a limited extent - Ruby) is to use MacRuby and its Core Data libraries.

Core Data seemingly can be exposed as an Active Record. https://www.google.com/search?q=macruby+coredata , notably http://www.spacevatican.org/2012/1/26/seeding-coredata-databases-with-ruby/

However, MacRuby seems to have faded - https://github.com/MacRuby/MacRuby/issues/231 - it won't even compile on Mavericks.

Martin Cleaver
  • 909
  • 8
  • 21
0

Other answers might include:

Community
  • 1
  • 1
Martin Cleaver
  • 909
  • 8
  • 21