From 2d1ee66a2b6459540967d578cc534dc893546e12 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Wed, 28 Oct 2020 18:47:10 +0100 Subject: [PATCH] fix(ios): correctly append exif on iOS 14 (#685) --- src/ios/CDVCamera.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m index 0d6e7e5..2f2738b 100644 --- a/src/ios/CDVCamera.m +++ b/src/ios/CDVCamera.m @@ -651,13 +651,15 @@ static NSString* toBase64(NSData* data) { CDVPluginResult* result = nil; if (self.metadata) { - CGImageSourceRef sourceImage = CGImageSourceCreateWithData((__bridge CFDataRef)self.data, NULL); + NSData* dataCopy = [self.data mutableCopy]; + CGImageSourceRef sourceImage = CGImageSourceCreateWithData((__bridge CFDataRef)dataCopy, NULL); CFStringRef sourceType = CGImageSourceGetType(sourceImage); CGImageDestinationRef destinationImage = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)self.data, sourceType, 1, NULL); CGImageDestinationAddImageFromSource(destinationImage, sourceImage, 0, (__bridge CFDictionaryRef)self.metadata); CGImageDestinationFinalize(destinationImage); + dataCopy = nil; CFRelease(sourceImage); CFRelease(destinationImage); }