fix(ios): correctly append exif on iOS 14 (#685)

This commit is contained in:
jcesarmobile 2020-10-28 18:47:10 +01:00 committed by GitHub
parent ebe0517a24
commit 2d1ee66a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}