Re: Archiving ABPerson - Solution
Re: Archiving ABPerson - Solution
- Subject: Re: Archiving ABPerson - Solution
- From: Scott Ahten <email@hidden>
- Date: Sat, 8 May 2004 14:06:11 -0400
On May 8, 2004, at 10:05 AM, Dr. H. Nikolaus Schaller wrote:
So,
here is a solution using a non-documented private initializer:
Which also translates into...
ABPerson * newPerson =[[[ABPerson alloc] initWithUniqueId:@"aUID"]
initWithVCardRepresentation: vCardData];
So, my opinion is that initWithVCardRepresentation: should be renamed
to setFromVCardRepresentation:
A quick glance at the vCard spec shows that a Unique ID can be assigned
to the vCard as a whole, but it's optional.
---
Unique Identifier
This property specifies a value that represents a persistent, globally
unique identifier associated with the object. The property can be used
as a mechanism to relate different vCard objects. Some examples of
valid forms of unique identifiers would include ISO 9070 formal public
identifiers (FPI), X.500 distinguished names, machine-generated
"random" numbers with a statistically high likelihood of being globally
unique and Uniform Resource Locators (URL). If an URL is specified, it
is suggested that the URL reference a service which will produce an
updated version of the vCard.
This property is identified by the property name UID. This property is
provided to enable a vCard Reader and Writer to uniquely identify
either a vCard object instance or properties within a vCard object.
Valid values for this property are a unique character string. The
following is an example of this property:
UID:19950401-080045-40000F192713-0052
Support for this property is optional for vCard Writers conforming to
this specification.
---
When I call NSLog([person description]) on my ABPerson received from
Address Book, it includes the following entry...
UID = "EB19929A-4B72-11D7-AC10-000A957713B6:ABPerson"
but it's missing after being converted back to a ABPerson from vCard
format. This looks like one of the UIDs described above. However, none
of the sample vCards from other applications I've looked at contained a
UID. Maybe it's not commonly used or I've misread the spec.
This leads me to a few questions...
Q. Are ABRecord UIDs private to Address Book's implementation [like a
primary key in a database table] or are they globally unique and
shareable as the UI entry in the vCard spec suggests?
Q. What about vCards created in other applications that don't contain
UIDs?
A. initWithVCardRepresentation: could look for a UID in the vCard and
use it if found. Otherwise, create a new UID from scratch.
Q. Can UIDs from other applications be used by the Address Book
implementation?
A. UIDs might not be unique or have a invalid value. This might create
corrupt ABRecords or other problems. An option would be to only use
UIDs that contain ":ABxxxxx." Otherwise generate a new UID.
Unless UIDs are private to the Address Book implementation, I would
think that some method of retaining the UID of the record would be
important. Especially if ABPerson doesn't officially support
Archiving.
- Scott
- - - - -
:: email@hidden
::
http://www.pixelfreak.net
- - - - -
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.