• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How can I add persistent data to a Cocoa CoreData file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I add persistent data to a Cocoa CoreData file?


  • Subject: How can I add persistent data to a Cocoa CoreData file?
  • From: Daniel Wambold <email@hidden>
  • Date: Sat, 28 Jul 2007 10:29:14 -0400

This is probably a very simply question but I'm a rank novice....
I have created an application in XCode using CoreData and the xcdatamodel tool included in XCode. The program works fine, but I've realized that I need to tag the data file with a version number so I can add features and not run into problems when the data file is not up to date with the program. Short of re-creating the data file from scratch, I'd like to:
(1) Look for the presence of a (?NSString) in the data file on application launch. (Currently, the file is loaded automatically by the program, as I have set
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
to return TRUE. The NSString would only have to exist once, not for every record in the file, if that's easier.
(2) Initially, find that there is no such NSString and assume the version is "oldest." Update the file, then add the NSString to the persistent store (say, "v1.1").
(3) Subsequently, find the NSString, read the stored version data (say, "v1.1") and decide if that's current or needs updating.
I just don't know what I need to do to create a variable that's then automatically included in the data that CoreData saves. I'm suspicious that it's something along the lines of creating an NSManagedObject, but I don't actually know what an NSEntityDescription is, despite having read the docs several times.
If anyone has done something like this and could show me the basic code, I'd be grateful!
-Dan
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How can I add persistent data to a Cocoa CoreData file?
      • From: Jim Correia <email@hidden>
  • Prev by Date: Re: Autorelease/Retain/Release
  • Next by Date: Re: Changing the app language
  • Previous by thread: Re: Gradient NSOutlineView row - Text color of it's NSTextFieldCell
  • Next by thread: Re: How can I add persistent data to a Cocoa CoreData file?
  • Index(es):
    • Date
    • Thread