Location PHAsset - GPS MetaData, what's wrong?

trying to add location from UIImage using Phasset:

// image is a variable like so: image: UIImage var newAsset = PHAssetChangeRequest.creationRequestForAssetFromImage(image) newAsset.location = CLLocation(latitude: coordinate.latitude, coordinate.longitude) 

this code seems to work → save the new asset in the photo library with a good coordinate. I see this in the library itself.

but when I use exif tools and the like, most of the time, the GPS dictation is empty, as if the location has not been set. (also, I noticed that the GPS information is not in exif format) therefore, I think the location information is also located somewhere else ...

so what's wrong with the location PHAsset property? How to set the correct location?

+3
ios swift photokit
Jul 27 '15 at 23:08
source share
1 answer

Photos tracks the location of metadata in its own database, separately from EXIF ​​metadata stored in each photo file. When you (as a client of the Photos API) or a user create / add a new asset, Photos reads the EXIF ​​location data from the file and sets the location in its database to match. However, the Photos API does not make any effort to synchronize them.

If you want to update the EXIF ​​metadata in the file, you will need to do it yourself. (Image I / O can help with this - see this answer .) Then add the entire file, not just the UIImage created from it, to the Photo using creationRequestForAssetFromImageAtFileURL: or the new PHAssetCreationRequest in iOS 9.

+5
Jul 27 '15 at 23:35
source share



All Articles