First, a little head way...
According to some cached documentation (thanks google!) I've located a
snippet that appears to do exactly what I require, however, there's a
nice notice saying NOT to use this in a production environment.
Taking that as a queue, I am assuming that persisting the "nextIndex"
or "maxIndex" or whatever I call it and incrementing that value is the
preferred way of handling this task. Naturally I can't say that I'm a
huge fan of this method, but I suppose it will work, if only for
applications with low insertion counts...
If anyone else has a better solution, please feel free :-)
From:http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/03_CustomClass/chapter_4_section_4.html
----
The following implementation is crude (and should not be used in a
production application—the initial tempID reverts to 1 every time the
application is launched), it serves, however, to quickly illustrate
the principle.
- (void)awakeFromInsert
{
static int tempID = 1;
[super awakeFromInsert];
self.employeeID = [NSNumber numberWithInt:tempID++];
}
----
As a side note, I think I'm going to cry, it doesn't appear that the
iPhone SDK is supported on PPC... sniff sniff... Now I'm kind of upset
that I can't get to the rest of the developer documentation...
Regards,
Joshua Preston
[EMAIL PROTECTED]
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]