Address Book Framework and Group Selection
Address Book Framework and Group Selection
- Subject: Address Book Framework and Group Selection
- From: Chip Coons <email@hidden>
- Date: Thu, 23 Dec 2004 00:13:19 -0600
I have an application with two instances of and ABPeoplePickerView embedded. One view shows the entire address book. The other shows a specific group within the address book.
The specific group view represents a team. The group is created using the team name by:
//...
ABGroup *theGroup;
ABAddressBook *addressBook = [ABAddressBook sharedAddressBook];
self groupForTeamExists:groupName]){
theGroup = [[[ABGroup alloc] init] autorelease];
if([theGroup setValue:groupName forProperty:kABGroupNameProperty]){
[addressBook addRecord:theGroup];
[addressBook save];
}else{
NSLog(@"Error: Failed to create group in address book");
}
}
...//
In a different method (called after the group is created), the team group is selected by:
//...
ABGroup *theGroup = [self getGroupForTeam:groupName];
[ppView_Team setAllowsGroupSelection:NO];
[ppView_Team setAllowsMultipleSelection:YES];
[ppView_Team clearSearchField:self];
[ppView_Team deselectAll:self];
[ppView_Team selectGroup:theGroup byExtendingSelection:NO];
...//
This approach works for the second invocation (i.e. after the group is created) by setting the selection in the group pane of the ABPeoplePickerView to the group associated with the team name. However, it fails on the first pass when the program creates the group initially. It only selects the "All" group at the top of the groups list.
I know that the group has been created with the correct name at the point the second method is called. Am I missing something or is this a bug I need to report?
Any thoughts or suggestions would be appreciated.
Thanks,
-Chip Coons
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden