【问题标题】:iOS 13 photo content is cleared during saveiOS 13 照片内容在保存期间被清除
【发布时间】:2020-01-14 09:15:46
【问题描述】:

当我用exif信息拍照并想将其保存在手机上时,由于在此过程中清除了内容,因此图像未保存。

CGImageSourceRef sourceImage = CGImageSourceCreateWithData((__bridge_retained CFDataRef)self.data, NULL);
CFStringRef sourceType = CGImageSourceGetType(sourceImage);

CGImageDestinationRef destinationImage = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)self.data, sourceType, 1, NULL);
CGImageDestinationAddImageFromSource(destinationImage, sourceImage, 0, (__bridge CFDictionaryRef)self.metadata);

ok = CGImageDestinationFinalize(destinationImage);

NSString *extension = self.pickerController.pictureOptions.encodingType == EncodingTypePNG ? @"png":@"jpg";
NSString *filePath = [self tempFilePath:extension];

// save file
if (![self.data writeToFile:filePath options:NSAtomicWrite error:&err]) {
    …
} else {
    …
}

self.data 在函数CGImageDestinationCreateWithData 被调用后被清除。 ok var 每次都是 NO

在 iOS 12 上,代码按预期工作,问题仅出现在 iOS13 上。

为了测试,我使用了 xCode 11 GM Seed 和 iOS 13 GM Seed。

这里是完整的代码:https://github.com/remoorejr/cordova-plugin-camera-with-exif/blob/master/src/ios/CDVCamera.m#L840

【问题讨论】:

    标签: ios objective-c ionic-framework camera exif


    【解决方案1】:

    【讨论】:

    • Alexandru,您的修复似乎工作正常。你知道为什么 CGImageDestinationCreateWithData 会清除数据吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多