• 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
Re: Unique items in Core Data models
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unique items in Core Data models


  • Subject: Re: Unique items in Core Data models
  • From: Diederik Hoogenboom <email@hidden>
  • Date: Thu, 17 May 2007 12:05:43 +0200

Which changes when you save the object to a store (or migrate the data to another store). This can be a problem when you want to use the Unique ID before saving.


Diederik

--
Diederik Hoogenboom
Obvious Matter
http://www.obviousmatter.com

--
Diederik Hoogenboom
Obvious Matter
http://www.obviousmatter.com



On 16-mei-2007, at 21:59, mmalc crawford wrote:


On May 16, 2007, at 11:12 AM, Diederik Hoogenboom wrote:

One possible solution is to add a uuid attribute to your entity then have the following code in your awakeFrominsert:
CFUUIDRef UUID = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef UUIDString = CFUUIDCreateString (kCFAllocatorDefault,UUID);
[self setValue:(NSString *)UUIDString forKey:@"uuid"];
CFRelease(UUID);
CFRelease(UUIDString);
This will generate a unique string to identify your managed object.


Managed objects already have a unique ID -- the objectID.
The issue is, how do you subsequently ensure uniqueness of a particular attribute...


mmalc



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Unique items in Core Data models
      • From: mmalc crawford <email@hidden>
References: 
 >Unique items in Core Data models (From: Keith Penrod <email@hidden>)
 >Re: Unique items in Core Data models (From: Diederik Hoogenboom <email@hidden>)
 >Re: Unique items in Core Data models (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: NSURLDownload and handling HTTPS certificates
  • Next by Date: Sorting with blank and special characters
  • Previous by thread: Re: Unique items in Core Data models
  • Next by thread: Re: Unique items in Core Data models
  • Index(es):
    • Date
    • Thread