Re: AddressBook Problem
Re: AddressBook Problem
- Subject: Re: AddressBook Problem
- From: Pete <email@hidden>
- Date: Fri, 24 Feb 2006 21:35:41 +0100
All in all, I had 3 (of about 200) users report about this problem,
so there really seems to be a connection between my app and the data
loss.
Or could it be a bug in the AddressBook? Cause the problem first
appeared when os 10.4 was released and all users reporting
the problem had the AddressBook app running while using my app to
import the data.
Also, they import something around 200 or more addresses...
I also found other reports on the net due to which I thought it might
be a bug in the AddressBook:
http://www.macosxhints.com/article.php?story=20050808174908732
http://macslash.org/article.pl?sid=05/12/19/0358233&mode=thread
Here's my programs code for importing the addresses:
The idea is, to only import the group named "groupString".
There's a second import function in my code importing every record in
the AB that looks about the same,
except that it doesn't have the group-loop and starts with
"personArray = [addressBook people]".
addressBook = [ABAddressBook sharedAddressBook];
groupArray = [addressBook groups];
/* import each group */
for(i = 0; i < [groupArray count]; i++){
group = [groupArray objectAtIndex: i];
/* only continue if we want to import this group (compare its name) */
if([[group valueForProperty: kABGroupNameProperty] isEqualToString:
groupString]){
personArray = [group members];
/* import each person in the group */
for(j = 0; j < [personArray count]; j++){
person = [personArray objectAtIndex: j];
/* get email address */
emailData = [person valueForProperty: kABEmailProperty];
if([emailData count])
emailString = [emailData valueAtIndex: [emailData
indexForIdentifier: [emailData primaryIdentifier]]];
else
emailString = [NSString stringWithString:@""];
/* add data to data array */
rowArray = [[NSMutableArray alloc] init];
DoAddStringToArray(rowArray, [group valueForProperty:
kABGroupNameProperty]);
DoAddStringToArray(rowArray, [person valueForProperty:
kABNoteProperty]);
DoAddStringToArray(rowArray, [person valueForProperty:
kABJobTitleProperty]);
DoAddStringToArray(rowArray, [person valueForProperty:
kABOrganizationProperty]);
DoAddStringToArray(rowArray, [person valueForProperty:
kABLastNameProperty]);
DoAddStringToArray(rowArray, [person valueForProperty:
kABFirstNameProperty]);
DoAddStringToArray(rowArray, [person valueForProperty:
kABTitleProperty]);
DoAddStringToArray(rowArray, emailString);
/* adds the array to a table view... */
[tableView addRow: -1 withData: rowArray];
[rowArray release];
}
}
}
void DoAddStringToArray (NSMutableArray *array, NSString *string)
{
if(string)
[array insertObject: string atIndex: 0];
else
[array insertObject: [NSString stringWithString:@""] atIndex: 0];
}
_______________________________________________
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