AB: created+added personRef is not returned by ABAddressBookCopyArrayOfAllPeople

Originator:heardrwt
Number:rdar://10898970 Date Originated:20 Feb 12
Status:Open Resolved:
Product:iPhone SDK Product Version:5.0.0
Classification:Serious Bug Reproducible:Always
 
Summary:
AddressBook: Newly created and added personRef is not returned by ABAddressBookCopyArrayOfAllPeople until after the addressbook is saved.

This behaviour diverges from the what happens with adding a group to the default source


Steps to Reproduce:

-(void)testABBug{
    ABAddressBookRef ab = ABAddressBookCreate();
    CFArrayRef peopleRefs = ABAddressBookCopyArrayOfAllPeople(ab);
    NSUInteger preAddCount = CFArrayGetCount(peopleRefs);
    CFRelease(peopleRefs);
    
    ABRecordRef newPersonRef = ABPersonCreate();
    ABAddressBookAddRecord(ab, newPersonRef, NULL);
    
    peopleRefs = ABAddressBookCopyArrayOfAllPeople(ab);
    NSUInteger postAddCount = CFArrayGetCount(peopleRefs);
    CFRelease(peopleRefs);
    
    NSAssert(preAddCount + 1 == postAddCount, @"peopleRefs count should be == previous count + 1 after adding a person to the addressbook");
    
    CFRelease(newPersonRef);
    CFRelease(ab);

}


Expected Results:
No assert

Actual Results:
assert

Regression:
repros on 4.3 & 5.0

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!