gpt4 book ai didi

iphone - 是否可以通过 UIActivityViewController 共享图像并保留 exif 数据?

转载 作者:行者123 更新时间:2023-12-03 19:01:04 33 4
gpt4 key购买 nike

我有一个应用程序,可以通过

将图像保存到相机胶卷中的自定义相册中
    [library writeImageToSavedPhotosAlbum:[newTestImage CGImage] metadata:metadata
completionBlock:^(NSURL *assetURL, NSError *error) {
//error
}
];

这工作正常,但是,我想允许用户从应用程序内共享这些图像,我是通过

    ALAsset *assetToShare = self.images[indexPath.row];
NSString *stringToShare = @"…..";
NSArray *dataToShare = @[assetToShare, stringToShare];

UIActivityViewController *activityVC = [[UIActivityViewController alloc]
initWithActivityItems:dataToShare applicationActivities:nil];

[self presentViewController:activityVC animated:YES completion: ^{
//Some Expression
}];}

但是这样做会删除图像中的所有 exif 数据,有没有办法可以实现相同的功能但保留元数据?非常感谢您的帮助。

编辑:用于输入 ALAssets 的代码

    if ([[group valueForProperty:ALAssetsGroupPropertyName] isEqualToString:@"my pics"]) {
[self.assetGroups addObject:group];
_displayArray = [self.assetGroups objectAtIndex:0]; ...}];

然后:

   [_displayArray enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
if (result) {
[self.images addObject:result]; }];

最佳答案

你尝试过这样的事情吗?只是传递实际图像。

ALAsset *assetToShare = self.images[indexPath.row];

ALAssetRepresentation *rep = [assetToShare defaultRepresentation];

UIImage *imageToShare = [UIImage imageWithCGImage:[rep fullResolutionImage]];

NSString *stringToShare = @"…..";
NSArray *dataToShare = @[imageToShare, stringToShare];

UIActivityViewController *activityVC = [[UIActivityViewController alloc]
initWithActivityItems:dataToShare applicationActivities:nil];

[self presentViewController:activityVC animated:YES completion: ^{
//Some Expression
}];}

关于iphone - 是否可以通过 UIActivityViewController 共享图像并保留 exif 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13439549/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com