我有一个应用程序,可以通过
将图像保存到相机胶卷中的自定义相册中 [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]; }];
答案 0 :(得分:0)
你尝试过这样的事吗?只是传递实际图像。
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
}];}