From d89c25cd8283b2d9503120459245d7d9a637c89f Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 25 Jun 2020 18:23:01 +0200 Subject: [PATCH] fix(ios): tempFilePath called twice if using CameraUsesGeolocation (#612) --- src/ios/CDVCamera.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index d4c084b..8b775d4 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -383,6 +383,7 @@ static NSString* toBase64(NSData* data) { } [[self locationManager] startUpdatingLocation]; } + data = nil; } } break; @@ -396,15 +397,10 @@ static NSString* toBase64(NSData* data) { - (NSString*)tempFilePath:(NSString*)extension { NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath]; - NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe - NSString* filePath; - // unique file name NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970]; NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp]; - do { - filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension]; - } while ([fileMgr fileExistsAtPath:filePath]); + NSString* filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension]; return filePath; }