5

我有一个应用程序,可以通过以下方式将图像保存到相机胶卷中的自定义相册中

    [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]; }];
4

1 回答 1

1

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

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
}];}
于 2012-11-19T15:15:20.850 回答