Skip to content

Commit

Permalink
ImagePicker returning same image (#306)
Browse files Browse the repository at this point in the history
ImagePicker returning same image

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
Co-authored-by: Tim Brust <github@timbrust.de>
  • Loading branch information
3 people committed Sep 16, 2019
1 parent db4b4b9 commit a9436b1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ios/CDVCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,12 @@ - (NSString*)tempFilePath:(NSString*)extension
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
NSString* filePath;

// generate unique file name
int i = 1;

// unique file name
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
do {
filePath = [NSString stringWithFormat:@"%@/%@%03d.%@", docsPath, CDV_PHOTO_PREFIX, i++, extension];
filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension];
} while ([fileMgr fileExistsAtPath:filePath]);

return filePath;
Expand Down

0 comments on commit a9436b1

Please sign in to comment.