Sharing Core Data files

Discussion in 'Mac Programming' started by Macgenie, Dec 8, 2008.

  1. Macgenie macrumors newbie

    Joined:
    Jan 8, 2008
    Location:
    Suffolk, UK
    #1
    I work in a small office using 2 Macs on a LAN.

    I write applications using Obj C / XCode using Core Data and would like to enable these apps to file share over a LAN. I have scoured the internet and the ADC website in vain looking for support in terms of writing code etc. but so far have seen plenty about sqlite3 etc but nothing specific to ObjC / Core Data.

    In essence what I would like to achieve is something similar to File Maker Pro's ability to share files and in fact have had to resort to FM Pro to get my project off the ground. Although FM Pro is a terrific application I would still like to write my own stuff in ObjC - I would then have all the flexibility of designing my own interface and whatever functionality I could dream up. Will I have to write my own file sharing interface or is there an easier route I can go ?

    Any pointers will be much appreciated. :)
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    Are you wanting the two machines to share a single backing-store? If so, is it possible that they will both be accessing the file at the same time? I don't know how sqlite handles table/row-level locking, etc. so i don't know if this can be done "safely". The number one thing would be where the file is kept. I honestly don't know CoreData at all, so i don't know if you can choose where the sqlite file is stored. If that's easy to do, it seems like having the file on a network share, and the ability to configure where it's stored via a plist, etc. would be your best bet.

    Again, my biggest concern would be locking/contention for the file. If sqlite already handles this somehow, you should be fine.

    -Lee
     
  3. Macgenie thread starter macrumors newbie

    Joined:
    Jan 8, 2008
    Location:
    Suffolk, UK
    #3
    Sharing Core Dat Files

    Thanks for replying Lee; as to your questions I would want to keep the database store on my own hard drive and provide the remote user with a copy of the app (suitably altered to access the shared file) - so yes, I would expect the file to be accessed by more than one user at a time.

    I have read up on sqlite3 and concurrency is mentioned in one or two places; also Core Data can use a sqlite database as a backing store so it would seem on the face of it that the tools are all there.

    I would also expect to have the same set-up as Filemaker Pro uses, in that if a record is being edited on one machine the system locks that record while the editing is being carried out, but I don't know yet how this would work with Core Data file sharing. I guess this would mean more of an application level function rather than just relying on the file system to police everything.

    Your comment on using a plist to store config. data and using a networked shared file set-up sounds good, I think I will set up a small dummy app on both machines and see what happens. Win or lose I will learn something, anyhow.

    I have been thinking through several different ideas to get the functionality that I am after and I will start trying these schemes out, I just wondered if this had all been done already and I could save a bit of time! :)
     
  4. 4np macrumors 6502a

    4np

    Joined:
    Feb 23, 2005
    Location:
    The Netherlands
    #4
    Perhaps in your situation it's better to use a SQL server instead? Like MySQL?
     

Share This Page