Core data importing entities

Discussion in 'Mac Programming' started by MacDonaldsd, Jul 29, 2007.

  1. macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    Im building an application that relies heavily on core data.

    I was wondering if there is a way to import a single instance of a entity ?

    Maybe by running a applescript or something ?
     
  2. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    Do you mean that you want import an NSManagedObject from one model to another?

    Do you wish to copy related objects as well?
     
  3. thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #3
    Basically Im doing a timetable application. So modules that are related to assessments is what im referring to here.

    I would like to be able to just import assessment details. So a user can just import the details rather than typing them manually as everyone will have the same information.
     
  4. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #4
    So you want to import the assessment information from another file into your Core Data model for your application?

    In which case you'll need to read in the data using a normal (non Core Data) Cocoa data input system and then attach the data to the relevant NSManagedObject.
     
  5. thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #5
    So read it to a Normal object, then copy/create a NSManagedObject using code "behind the scenes" ?
     
  6. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #6
    Pretty much but you may not need to read it into a normal object at all as you may be able to read it as an int, double, BOOL, NSString etc. and then attach it directly to the NSManagedObject you wish to store the data in.

    However you have the basic idea.
     

Share This Page