Is it possible to share an image through a UIActivityViewController and save exif data?

I have an application that saves images to a custom album in a camera frame through

[library writeImageToSavedPhotosAlbum:[newTestImage CGImage] metadata:metadata completionBlock:^(NSURL *assetURL, NSError *error) { //error } ]; 

This works great, however, I would like the user to be able to share these images from the application, I did it through

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

However, while the image is deprived of all exif data, is there a way to implement the same functionality, but save the metadata? Thanks so much for any help.

Edit: code used to enter ALAssets

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

Then:

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

Have you tried something like this? Just convey the actual image.

 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 }];} 
0
source

Source: https://habr.com/ru/post/1446745/


All Articles