iOS 14+ GPS EXIF data from CAMERA

I am building an iOS app that uses the phone's GPS EXIF data from both camera and image library. My problem is that I while I am able to get GPS data from images in the phone's library, I have not been able to get any GPS data when using the camera within my app.

I first built this app about a year ago and at that time I was able to get GPS data from both the library AND the camera from within the app. I believe that at that point I was still building for iOS 12.. I believe that the new security features that came with iOS 13 or 14 now dissalow my app's access to the GPS data when using the camera.

  • This issue is new as of iOS 13 or 14. The code I had was working fine with earlier versions of iOS
  • I am having no issues with getting GPS from the EXIF on the device library images.
  • Images taken with the NATIVE IOS CAMERA APP are saved to the library with full GPS data.

 - However I am not able to get GPS data directly from camera image EXIF when using the camera from within my app.

  • When saving an image taking by the camera from within my app the image is saved to the library with NO GPS data.
  • I am able, at any time, to ask the device for current GPS coordinates.
  • As far as I can tell, device settings are all correct. Location services are available at all times.

 My feeling is that iOS is stripping the GPS data from the EXIF image before handing the image data to my app.

  • I have searched Apple developer forums, Apple documention, Stack Exchange, on and on for over several weeks now and I seem no closer to knowing if the camera API even returns this data or not and if it will be necessary for me to talk to the location services and add the GPS data myself (which is what I am working on now as I have about given up on getting it from the camera).

Info.plist keys I am currently setting:  LSRequiresIPhoneOS  NSCameraUsageDescription  NSLocationAlwaysUsageDescription  NSLocationWhenInUseUsageDescription  NSMicrophoneUsageDescription  NSPhotoLibraryUsageDescription  NSPhotoLibraryAddUsageDescription

Am I missing some required plist key? I have been searching and searching for the name of a key that I might be missing but have found absolutely nothing other than people trying to hack some post-camera device location merging.

This has been very frustrating.. Any insite is appreciated

  • Is it currently possible to get GPS data directly from the camera's EXIF output any more?
  • Do I need to ask the device for the current GPS values and insert the GPS data into the image EXIF on my own?
  • Is there any example code of getting GPS data from the camera?
  • Is there any example code of inserting GPS data into the Exif before saving the file to the device?

Sample swift code which processes the camera image.


  func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
    let pickedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
    // let pickedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage
    // using editedImage vs originalImage has no effect on the availabilty of the GPS data
    userImage.image = pickedImage
    picker.dismiss(animated: true, completion: nil)
  }

Hi jronmorgan,

Any finding on this I am also facing similar issue?

Hi @jronmorgan, @Archit_Dhupar Have you found a solution? I'm having a similar problem.

Also going through this. 2 years and no reply?

Im also going through this. 2 years later and there isn’t a single source of information online about this…

iOS 14+ GPS EXIF data from CAMERA
 
 
Q