I'm working on a share extension app for iOS and I need to record the creation date and location data from the asset. However it seems the file shared to us from system has location data stripped off of it. But I have noticed that when shared to app such as Facebook, they seem to have these data extracted from it (verified by their location suggestion when posting).
What I have done to verify is, when system provides the asset I have manually navigated to that location and added that photo or video back into photos library and sure enough, the location data is not present in that shared item. Is there a way I can request system to not strip these data when sharing to our app extension? How does the facebook app extract it?
Example on how I extracts data, printed log does not contain any gps section.
let data = NSData(contentsOf: url)!
let source = CGImageSourceCreateWithData(data as CFData, nil)!
let metadata = CGImageSourceCopyPropertiesAtIndex(source, 0, nil)!
print(metadata)
Thanks
With lots of trial and error I've realised the sensitive data when sharing is controlled by a user setting. On the share sheet of iOS (or photo library settings on OSX) there is a check box / tick to include location data for shared items. Using identical photo libraries on 2 devices, the device with facebook app had it turned ON and the test devices had them turned off which led to the confusion as to why the discrepancy. But it is clear now.