Re: OS X 10.3.x, Address Book, and initWithVCardRepresentation
Re: OS X 10.3.x, Address Book, and initWithVCardRepresentation
- Subject: Re: OS X 10.3.x, Address Book, and initWithVCardRepresentation
- From: Stefan Pantke <email@hidden>
- Date: Fri, 5 Mar 2004 18:44:01 +0100
Thanks for this detail!
Does someone know, where to find a current list of verified bugs?
Isolating a bug over and over and finally awaiting DTS feedback
seems to be a bad solution ;-)
Stefan
Am 05.03.2004 um 15:22 schrieb Guillaume Rager:
On Thu, 4 Mar 2004 20:58:11 -0600, Greg Anderson wrote:
On Mar 4, 2004, at 5:40 PM, Stefan Pantke wrote:
There is a bug with initWithVCardRepresentation method since 10.3.0,
it's reported to the bugreport and must be fixed (?) for the next
release. If you also attach a photo to your contact you should have
some surprises with vcard export/import.
Regards,
Greg,
I didn't used this feature (vCard), but I suppose, the UID is not
required the create a new
person, since UID are not guaranteed to be unique across systems -
unless you transfer
your whole AB from some backup media to the new AB. Thus, it seems
useless for me to transfer the
UID from one system to another system.
[Rest of the email snipped for brevity]
Perhaps I should rephrase my original email. I'm not trying to
transfer the UID of an ABPerson from one computer to the other -
truly, I wouldn't want to have to ensure that one UID is still unique
on another computer. What I'm seeing is that
-initWithVCardRepresentation isn't properly init-ing the ABPerson.
I whipped up this little app that just spits stuff out to the
console (forgive any poor code design):
//----------------------------------------------------------
#import <Cocoa/Cocoa.h>
#import <AddressBook/AddressBook.h>
int main(int argc, const char *argv[])
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
ABPerson *tempPerson = [[ABPerson alloc] init];
ABPerson *tempPerson2;
NSData *tempData;
NSLog(@"New person:\n%@\n\n", tempPerson);
[tempPerson setValue:@"Torgo" forProperty:kABFirstNameProperty];
NSLog(@"\nNew person with name:\n%@\n\n", tempPerson);
NSLog(@"\nMaking NSData of vCard\n\n");
tempData = [tempPerson vCardRepresentation];
NSLog(@"\nvCard looks like this:%@\n",
[[NSString alloc] initWithData:tempData
encoding:NSASCIIStringEncoding]);
NSLog(@"\nIniting tempPerson2\n\n");
tempPerson2 = [[ABPerson alloc]
initWithVCardRepresentation:tempData];
NSLog(@"\nvCard person:\n%@\n", tempPerson2);
[pool release];
return 0;
}
//----------------------------------------------------------
The output I get is this:
2004-03-04 20:44:52.565 App[12139] New person:
{
ABTableName = ABPerson;
Creation = 2004-03-04 20:44:52 -0600;
UID = "14017758-6E4F-11D8-817A-000393515CC8:ABPerson";
}
2004-03-04 20:44:52.568 App[12139]
New person with name:
{
ABTableName = ABPerson;
Creation = 2004-03-04 20:44:52 -0600;
First = Torgo;
UID = "14017758-6E4F-11D8-817A-000393515CC8:ABPerson";
}
2004-03-04 20:44:52.568 App[12139]
Making NSData of vCard
2004-03-04 20:44:52.611 App[12139]
vCard looks like this:BEGIN:VCARD
VERSION:3.0
N:;Torgo;;;
FN:Torgo
END:VCARD
2004-03-04 20:44:52.612 App[12139]
Initing tempPerson2
2004-03-04 20:44:52.624 App[12139] *** Assertion failure in
-[ABAddressBook
recordClassFromUniqueId:], Framework/AddressBook/ABAddressBook.m:1295
2004-03-04 20:44:52.625 App[12139]
vCard person:
{ABTableName = ABPerson; First = Torgo; }
App has exited with status 0.
All of this is as expected, except for the part where we init
tempPerson2 via -initWithVCardRepresentation. That's assertion
failure in ABAddressBook.m doesn't seem like a Good Thing. Also, note
that the description of tempPerson2 only has the ABTableName and
First properties, not a Creation property, and most importantly not a
UID property, unlike the ABPerson made with -init. I believe this is
why, when trying to add an ABPerson created with
-initWithVCardRepresentation fails in 10.3.x.
For kicks, I tried changing the tempPerson2 initialization lines to
be:
tempPerson2 = [[ABPerson alloc] init];
[tempPerson2 initWithVCardRepresentation:tempData];
Much to my surprise, this solved my problem, and got rid of the
ABAddressBook.m assert! What bothers me is this setup requires you to
call an "init" function twice. I was under the impression that
objects should never be initialized more than once - has this
changed?
Greg
---
Greg T. Anderson
"An apostrophe is not a warning that the letter 'S' is coming."
http://homepage.mac.com/torgo
_______________________________________________
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.
Guillaume
-----
GUMITECH - R&D Unit - Niort (France)
http://www.gumitech.com
"Chaud cocoa, chaud chocolat !!!"
_______________________________________________
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.
_______________________________________________
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.