Re: Unique items in Core Data models
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