Skip to content

Commit

Permalink
more sensible way to copy the image icons (no functional change)
Browse files Browse the repository at this point in the history
  • Loading branch information
npomfret committed Dec 20, 2016
1 parent 2258d78 commit 5f762d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ios/RCTContacts/RCTContacts.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit 5f762d3

Please sign in to comment.