AddressBook corruption (2)
AddressBook corruption (2)
- Subject: AddressBook corruption (2)
- From: Pete <email@hidden>
- Date: Wed, 1 Mar 2006 15:25:48 +0100
Hi again,
I still couldn't find a way to decide whether my app is causing the
corruption of the AddressBook
or not, but I got some more details from my customers about the problem.
-- For everyone who didn't read my previous posts:
I'm working on an Application importing a large amount (~2000) of
addresses from the AddressBook.
Some customers reported (about 3 of 200), that my app had deleted/
changed records in their AddressBooks
during import. They used it before, but suddenly, that bug appeared.
Since my app only uses few AddressBook calls to import data, I have
no clue how it could
cause records to be corrupted or deleted.
I got the first report of this problem after MacOS X 10.4 was
released. I haven't changed the importing
code for some time before that, so I thought the problem might be
caused by a bug in 10.4 ...
--
My customers reported, that the AddressBook was running while they
imported the data, but they aren't able
to reproduce the problem, as all imports seem to work now.
Also, their addresses don't contain any special data, just name and e-
mail address.
My program imported the correct addresses, but after that, the
addresses in the AddressBook were deleted.
I used MallocDebug and couldn't find any Leaks/Mem smashers/anything
else MallocDebug would report.
I'll post my code at the end of this mail. It imports every entry in
a group with the given name.
It's the only part of my code in which the AB API is used.
The 10.2.8 SDK is used at build time.
Any idea on how I could try to solve this problem? I planned to
release an update of my app, but I don't really
know what to do now since nobody can reproduce these problems... And
only 3 of 200 users ever noticed them... :-/
It'd already be helpful to know whether my code (posted at the
bottom) could cause such problems at all.
Thanks in advance for any help/tips/ideas
Pete
The code:
It imports all groups with the name "groupString". The addresses are
added to a table data source.
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