EXC_BAD_ACCESS crash when enumerating contacts

Hi,

I'm encountering a crash when attempting to enumerate contacts using a block-based enumeration method. The crash log shows an EXC_BAD_ACCESS error. I suspect the crash may be related to a memory management issue, but I'm having trouble pinpointing the exact cause. The crash have on Crashlytics but can not reproduce.

Has anyone else encountered this issue or have any suggestions for troubleshooting this type of crash?

Any help would be greatly appreciated. Thank you!

Crash log:

EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)

0  libobjc.A.dylib                0x307c objc_retain_x8 + 16
1  Contacts                       0x2c318 __52-[CNXPCDataMapper contactObservableForFetchRequest:]_block_invoke + 260
2  ContactsFoundation             0xc344 __26-[CNObservable doOnError:]_block_invoke + 320
3  ContactsFoundation             0xc728 __31-[CNObservable doOnCompletion:]_block_invoke + 320
4  ContactsFoundation             0xc728 __31-[CNObservable doOnCompletion:]_block_invoke + 320
5  ContactsFoundation             0xc344 __26-[CNObservable doOnError:]_block_invoke + 320
6  ContactsFoundation             0x8048 __27-[CNObservable doOnCancel:]_block_invoke + 252
7  ContactsFoundation             0xbb88 -[CNObservable enumerateObjectsUsingBlock:] + 404
8  Contacts                       0xb48f8 __91-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]_block_invoke.61 + 552
9  Contacts                       0x315c4 __38-[_CNContactsLogger fetchingContacts:]_block_invoke_2 + 44
10 libsystem_trace.dylib          0xa108 os_activity_apply_f + 88
11 Contacts                       0x221fc -[_CNContactsLogger fetchingContacts:] + 248
12 Contacts                       0x2149c -[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:] + 528
13 Contacts                       0x21174 -[CNContactStore pool_enumerateContactsWithFetchRequest:error:usingBlock:] + 268
14 Contacts                       0x22ab0 -[CNContactStore enumerateContactsWithFetchRequest:error:usingBlock:] + 492

Source code:

@synchronized (contactStore) {
    @try {
        [contactStore enumerateContactsWithFetchRequest:listKeyToFetch
                                                  error:&error
                                             usingBlock:^(CNContact* cnContact, BOOL* stop) {
                Contact *contact = [Contact newWithCNContact:cnContact];
                if (filter(contact)) {
                    [contacts addObject:contact];
                }
        }];
    }    
}

> I'm encountering a crash when attempting to enumerate contacts using a block-based enumeration method.

Please post a full crash report, per the advice in Posting a Crash Report.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Eskimo,

below is full crash report

Thanks for the crash report.

Thread 8 indicates that you have a third-party crash reporter in play. Please remove that and see if you can catch a ‘clean’ crash report [1].

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] I don’t trust crash reports where third-party crash reporters are in play for the reasons I explain in Implementing Your Own Crash Reporter.

EXC_BAD_ACCESS crash when enumerating contacts
 
 
Q