1

I am creating an IOS app which can hide the photos the user been selected. I am able to do that, but the problem is, if the user selects again the already been selected photo, how do i need to check they are SAME ,i looked into the metadata info of the photo, but that can match to some other photo having same meta info, currently i have only idea to generate the checksum based on whole photo data with bytes, which i think may cause memory issue and also degrades performance.so any expertise help will be needful.thanks in advance.

__block NSMutableDictionary *imageMetadata = nil;
ALAssetsGroupEnumerationResultsBlock assetsEnumerationBlock = ^(ALAsset *result, NSUInteger index, BOOL *stop) {

    if (result) {
        [self.assets addObject:result];
        NSDictionary *metadata = result.defaultRepresentation.metadata;
        imageMetadata = [[NSMutableDictionary alloc] initWithDictionary:metadata];
        NSLog(@"%@",imageMetadata.description);
    }
};
virtplay
  • 550
  • 7
  • 18
  • 1
    see the answer from Joanne in this SO: http://stackoverflow.com/questions/4314405/how-can-i-get-the-name-of-image-picked-through-photo-library-in-iphone – user523234 Jan 24 '15 at 15:13

2 Answers2

0

Seems like you could be handling image-identification at the front end.

If self.assets is an array, and even if your hiding photos while in a tableView (which would change the indexPaths), why not use arrayIndex in another array that houses all, lets say.. NSNumbers of hidden self.assets indexes.

But this is only after you exhausted all forms of Metadata identifiers? perhaps a combination of metadata-strings could yield something unique?

How are you dealing with this in the UI; a TableView?

jasonIM
  • 193
  • 2
  • 13
  • Yes iam using indexes, but i wanted to give flexibility for users , like they can delete the photos,export to file and mail all such things, so thats the problem. – virtplay Jan 25 '15 at 15:02
0

I think, you can make use of ALAssetPropertyURLs, which maps asset representations UTIs to URLs that uniquely identify the asset.

To get this, use result.defaultRepresentation.url

The url should be like assets-library://asset/asset.JPG?id=1000000477&ext=JPG:

Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102