From 5f762d3bf18ab716523cb1308565dfe9c19a7d00 Mon Sep 17 00:00:00 2001 From: npomfret Date: Tue, 20 Dec 2016 11:52:52 +1100 Subject: [PATCH] more sensible way to copy the image icons (no functional change) --- ios/RCTContacts/RCTContacts.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/RCTContacts/RCTContacts.m b/ios/RCTContacts/RCTContacts.m index b94da59a..da66aaa3 100644 --- a/ios/RCTContacts/RCTContacts.m +++ b/ios/RCTContacts/RCTContacts.m @@ -230,11 +230,11 @@ -(NSDictionary*) dictionaryRepresentationForABPerson:(ABRecordRef) person -(NSString *) getABPersonThumbnailFilepath:(ABRecordRef) person { - NSString* dir = [self getPathForDirectory:NSCachesDirectory]; - NSString* filepath = [NSString stringWithFormat:@"%@/contact_%@.png", dir, recordID.stringValue]; - if (ABPersonHasImageData(person)){ - + + NSNumber *recordID = [NSNumber numberWithInteger:(ABRecordGetRecordID(person))]; + NSString* filepath = [NSString stringWithFormat:@"%@/contact_%@.png", [self getPathForDirectory:NSCachesDirectory], recordID]; + NSData *contactImageData = (__bridge NSData *)ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatThumbnail); BOOL success = [[NSFileManager defaultManager] createFileAtPath:filepath contents:contactImageData attributes:nil];