I have this code to store all contacts image in dictionary. But, in some cases when it is interrupted, the image for contacts just disappear.
dispatch_async(dispatch_get_main_queue(), ^{
if (ABPersonHasImageData(_personObj)) {
// UIImage *image = [UIImage imageWithData:(__bridge NSData*) ABPersonCopyImageDataWithFormat(_personObj, kABPersonImageFormatThumbnail)];
NSData *data = (__bridge NSData *) ABPersonCopyImageDataWithFormat(_personObj, kABPersonImageFormatThumbnail);
UIImage *image = [UIImage imageWithData:data scale:1];
int recordId = ABRecordGetRecordID(_personObj);
[contactImagesDi setValue:image forKey:[NSNumber numberWithInt:recordId]];
}
});