Re: AddressBook: Why can't I add a person, that is not (yet) in the AB, to a group?
Re: AddressBook: Why can't I add a person, that is not (yet) in the AB, to a group?
- Subject: Re: AddressBook: Why can't I add a person, that is not (yet) in the AB, to a group?
- From: Henri Lamiraux <email@hidden>
- Date: Tue, 17 Dec 2002 07:38:26 -0800
Yes, this is a known problem. The way groups keep track off members
require the members to already be in the db. I am looking at fixing
this in a future release but it won't change for Jaguar.
On Tuesday, December 17, 2002, at 01:08 AM, Alexandre Aybes wrote:
Hi there,
I am writing a little application that needs to serialize and
deserialize address book entries to send over a socket connection, it
works fine with ABPerson objects, but when I get to the ABGroup I have
one problem:
When I deserialize the group, I need to recreate the persons that were
embedded in the group unfortunately it seems that addMember silently
fails when the person is not in the addressBook already, it does NOT
return NO, and does not throw an exception, but it logs in the
console: "Could not find person in group"
Here are 2 code snipets that reproduce the issue:
Works:
ABGroup* rootGroup = [[[ABGroup alloc] init] autorelease];
ABPerson* person = nil;
[rootGroup setValue:@"Test Root Group"
forProperty:kABGroupNameProperty];
person = [self createTestPerson];
[[ABAddressBook sharedAddressBook] addRecord:person];
NSLog(@"Person: %@", person);
[self assertTrue:[rootGroup addMember:person] message:@"Could not add
member"];
Does NOT work:
ABGroup* rootGroup = [[[ABGroup alloc] init] autorelease];
ABPerson* person = nil;
[rootGroup setValue:@"Test Root Group"
forProperty:kABGroupNameProperty];
person = [self createTestPerson];
NSLog(@"Person: %@", person);
[self assertTrue:[rootGroup addMember:person] message:@"Could not add
member"];
The only difference between the 2 snipets is that in one case I
actually add the person to the shared address book before adding it to
the group.
Is this an expected behavior or a bug? The fact that it does not
return NO seems strange to me anyhow. If this is not an expected
behavior, I will file a bug against it.
Thanks a lot,
Alex.
PS: I am running Mac OS X 10.2.2 and have not tried this on any other
version of OS X.
PPS: the code is not complete but illustrates the problem, and yes it
is part of a unit test for my application, and no, the assertion
around the addMember never fails, even though the person is not added
to the group.
--
SearchBar, the best way to search all your favorite web based search
engines
http://www.PommSoft.com/searchbar
_______________________________________________
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.
Henri Lamiraux
Engineering Manager
User Interface Tools Group
Apple
_______________________________________________
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.