ImagePicker returning same image (#306)

ImagePicker returning same image

Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
Co-authored-by: Tim Brust <github@timbrust.de>
This commit is contained in:
klodha 2019-09-16 15:10:54 +05:30 committed by Tim Brust
parent db4b4b947d
commit a9436b1a18

View File

@ -398,11 +398,12 @@ static NSString* toBase64(NSData* data) {
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath]; NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
NSString* filePath; NSString* filePath;
// generate unique file name // unique file name
int i = 1; NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
do { 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]); } while ([fileMgr fileExistsAtPath:filePath]);
return filePath; return filePath;