mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-19 03:42:52 +08:00
fix(ios): tempFilePath called twice if using CameraUsesGeolocation (#612)
This commit is contained in:
parent
ba4f77468f
commit
d89c25cd82
@ -383,6 +383,7 @@ static NSString* toBase64(NSData* data) {
|
|||||||
}
|
}
|
||||||
[[self locationManager] startUpdatingLocation];
|
[[self locationManager] startUpdatingLocation];
|
||||||
}
|
}
|
||||||
|
data = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -396,15 +397,10 @@ static NSString* toBase64(NSData* data) {
|
|||||||
- (NSString*)tempFilePath:(NSString*)extension
|
- (NSString*)tempFilePath:(NSString*)extension
|
||||||
{
|
{
|
||||||
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
|
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
|
||||||
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
|
|
||||||
NSString* filePath;
|
|
||||||
|
|
||||||
// unique file name
|
// unique file name
|
||||||
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
||||||
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
|
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
|
||||||
do {
|
NSString* filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension];
|
||||||
filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension];
|
|
||||||
} while ([fileMgr fileExistsAtPath:filePath]);
|
|
||||||
|
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user