ios - How do I fetch photos per Geo Location? -
i'm assuming should use 'phfetchoptions' formulate predicate fetch photos (phassets) per exif tags (geo location or 'tags').
how that?
...or, there better way?
example: fetch photos taken within san francisco's latitude/longitude photo library.
you cannot, specified in documentation:
construct predicate properties of class of photo entities want fetch, listed in table 1: self, localidentifier, creationdate, modificationdate, mediatype, mediasubtypes, duration, pixelwidth, pixelheight, favorite (or isfavorite), hidden (or ishidden), burstidentifier
you have fetch photos in library , filter result after:
if ([phphotolibrary authorizationstatus]!=phauthorizationstatusdenied) { phfetchresult *allphotosresult = [phasset fetchassetswithmediatype:phassetmediatypeimage options:nil]; [allphotosresult enumerateobjectsusingblock:^(id _nonnull obj, nsuinteger idx, bool * _nonnull stop) { phasset *photo = obj; if (photo.location) { [photos addobject:photo]; } if (allphotosresult.count-1 == idx) { [self showphotosonmap]; } }]; }
Comments
Post a Comment