Ios 将NSData转换为包含元数据的UIImage(EXIF数据)

Ios 将NSData转换为包含元数据的UIImage(EXIF数据),ios,objective-c,uiimage,nsdata,Ios,Objective C,Uiimage,Nsdata,MyNSData包含从外部硬件拍摄的图像,它具有元数据。。我已经通过将图像上传到AWS进行了测试 我尝试了以下两种转换: UIImage *image = [UIImage imageWithData:_downloadedImageData ]; UIImage *image = [[UIImage alloc] initWithData:_downloadedImageData]; 我做了研究,发现每当NSData转换为UIImage或反之亦然,元数据(EXIF数据)就会丢失。如何进行转

My
NSData
包含从外部硬件拍摄的图像,它具有元数据。。我已经通过将图像上传到AWS进行了测试

我尝试了以下两种转换:

UIImage *image = [UIImage imageWithData:_downloadedImageData ];

UIImage *image = [[UIImage alloc] initWithData:_downloadedImageData];
我做了研究,发现每当
NSData
转换为
UIImage
或反之亦然,元数据(EXIF数据)就会丢失。如何进行转换,以使我的元在两种转换中都存在,即
NSData
UIImage
,反之亦然

非常感谢您的帮助

请尝试此代码

创建保存图像数据的路径

NSArray *pathArr = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
                                                   NSUserDomainMask,
                                                   YES);
NSString *path = [[pathArr objectAtIndex:0]
              stringByAppendingPathComponent:@"_downloadedImageData.data" ];
检索保存的数据

NSData *retrievedData = [NSData dataWithContentsOfFile:path];
UIImageView *img = [[UIImageView alloc] 
                  initWithFrame:CGRectMake(100, 100, 200, 200)];
img.image = [UIImage imageWithData:retrievedData];
[self.view addSubview:img];

不,它不起作用。。我尝试了以下所有组合:[[pathArr objectAtIndex:0]stringByAppendingPathComponent:@“\u downloadedImageData.data”];[[pathArr objectAtIndex:0]stringByAppendingPathComponent:@“\u downloadedImageData”];[[pathArr objectAtIndex:0]stringByAppendingPathComponent:@“downloadedImageData.data”];[[pathArr objectAtIndex:0]stringByAppendingPathComponent:@“downloadedImageData”]@NithinReddyGaddam请跟随