PHAsset of older photos is missing GPS info in Swift

I've been working in Swift on iOS to access images via UIImagePickerController, pulling the PHAsset from the picker delegate's "info" dictionary, and then pulling GPS information from the PHAsset.

For newer photos, the asset.location is populated with GPS information.

Also, with newer photos, CIImage's property dictionary has {GPS} information.

So all is good with newer photos.

But when I go back to images taken in 2017, asset.location is nil and there is no "{GPS} information in the CIImage.

However, if I export the photo from Photos app on my Mac and then view it in Preview, there *is* GPS information.

So am I missing some settings to find the GPS information in older photos using PHAsset on iOS?

Thanks,

Replies

Follow up:

I think (???) I figured it out!!

When selecting photos in the photo picker, if the photo is from a shared album, the GPS information isn't there. But if I find the original photo, it *does* have the GPS information.

Will continue testing.
  • I am seeing the exact same behavior, using OBJ-C but that's probably no relevant. I first noticed it using a picture from 2017 as well. My App used to receive GPS info when querying this picture when it was run in 2020, but no longer in 2021. I have no idea when this breakage happened, but it's clear it's a bug outside my App. Too bad I have no idea how to debug this on my own ...

Add a Comment

Just to highlight my comment above, the pictures in question are not in a Shared album.

  • But asset.location does have the GPS information, so I'll just use that from now on. It seems to always be present even when {GPS} is not.

Add a Comment