MediaLibrary.CreateAssetAsync() and Exif GPS Location Data


(This is cross-posted from the slack general channel):

Happy to make an issue about this on the github repo, just wanted to check in first to see if anyone else has seen this question come up. A cursory search on the forums and slack has not pointed to any issues addressing this.

I’ll try to keep it concise:

Problem: SDK 33, platform: iOS - Taking a picture with Expo Camera.takePictureAsync() and then using MediaLibrary.createAssetAsync(uri) with Location services enabled does not tag the newly created asset with the location data.

Tested: When pulling exif data using MediaLibrary.getAssetInfoAsync the location is null for assets created using MediaLibrary.CreateAssetAsync.

iOS expo SDK 33 build CreateAssetAsync: expo/ABI33_0_0EXMediaLibrary.m at 5b2f50c5cbe19a3a15287dda8bf1195edfe93e6c · expo/expo · GitHub

According to the Swift Docs for PHAssetChangeRequest (Apple Developer Documentation) In order to set metadata props for location it should be done on the PHAssetChangeRequest by setting it to the location. That does not seem to be occurring in the snippet below:

[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
    PHAssetChangeRequest *changeRequest = assetType == PHAssetMediaTypeVideo
                                        ? [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:assetUrl]
                                        : [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:assetUrl];
    assetPlaceholder = changeRequest.placeholderForCreatedAsset;

If someone on the expo-team with more experiencing could confirm whether my thinking above is in the right direction I would be happy to submit a PR for this.

Thank you!

Just wanted to bump this one time to see if I could get a dev-response. Final bump.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.