简体   繁体   中英

How to set the location for the captured photo by using UIImagePickerController?

I would like to see my captured picture by using UIImagePickerController in Photos app with the geo tagging (Where the picture has taken).

While capturing a snap by using UIImagePickerController , I would like to tag the current location for the captured picture, such that when it get saved to PhotoLibrary , it should show on the map in the Photos (Standard app to show the photos/videos) app. Could anyone has any idea, how the Photos app internal mechanism to show the photos/videos on the map.

Unfortunately the location data requires a bit of work to find.

The delegate method

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 

will give you an info dictionary, containing some metadata for the image. This blog has a nice log dump of the typical content:

http://jomnius.blogspot.dk/2011/01/what-is-inside-uiimagepickercontrollerm.html

Based on the full path to the image (found in the info dictionary), you can however dig up the lat and long using ALAssetsLibrary

This blog explains the process in detail:

http://blog.codecropper.com/2011/05/getting-metadata-from-images-on-ios/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM