0

I'm reading Address Book in a background thread and I'm getting some crash reports with the following stacktrace.

    0    libsystem_kernel.dylib 
__pthread_kill + 8
1    libsystem_c.dylib  
abort + 94
2    AppSupport 
abortAfterPassingIntegrityCheck + 38
3    AppSupport 
runIntegrityCheckAndAbort + 526
4    AppSupport 
checkResultWithStatement + 120
5    AppSupport 
CPSqliteStatementReset + 60
6    AddressBook    
_imageStoreHasFullSizeImageForRecord + 102
7    AddressBook    
ABCImageStoreHasImagesForRecordWithFormat + 48
8    AddressBook    
ABCImageStoreHasImagesForRecord + 14
9    AddressBook    
ABCPersonHasImageDataEntries + 186
10   AddressBook    
ABCPersonHasImageData + 10
11   AddressBook    
ABPersonHasImageData + 8
12   Brewster ✭  AddressBookHandler.m line 501
-[AddressBookHandler needToImportPhotoContacts] + 50

I can not replicate, so it only happens sometimes. This code is just trying to see if a ABPerson has an image. What could cause this?

Thank you.

bneely
  • 9,083
  • 4
  • 38
  • 46
LocoMike
  • 5,626
  • 5
  • 30
  • 43

1 Answers1

5

I was seeing the same issue. It appears to be because the ABAddressBookRef can only be used by a single thread. Per ABAddressBookCreate documentation:

Important You must ensure that an instance of ABAddressBookRef is used by only one thread.

There is another article that also references this issue: http://blog.byadrian.net/2012/05/05/ios-addressbook-framework-and-gcd/

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
Matthew Purland
  • 290
  • 3
  • 5
  • Yeah, I was aware of that ABAddressBookRef limitation. My guess is that even I was aware, I was still violating it somewhere. Thanks for the reply anyway! I'm gonna accept your answer for taking the time and replying even though this question has been here for a while. – LocoMike Oct 22 '12 at 21:41