Objective-C - Adding GPS information to a photograph

↘锁芯ラ 提交于 2020-01-07 02:18:04

问题


I am wondering if it is possible to add GPS information to a photograph when saving the item to the camera roll.

The code I currently use to save the image is:

UIImage *theImage = (UIImage *)[info objectForKey: UIImagePickerControllerOriginalImage];
        UIImageWriteToSavedPhotosAlbum(theImage, self, 
                                       @selector(image:didFinishSavingWithError:contextInfo:), nil);

I am wondering how I can modify the image EXIF data to add the current location, and make it compatible with the 'Places' functionality on the iPhone.


回答1:


This example: http://caffeinatedcocoa.com/blog/?p=7 explains how to update the date of a photo. Go to CGImageProperties Reference and do the same replacing the key kCGImagePropertyExifDateTimeDigitized of the example with the relevant GPS keys. I haven't try this myself, but sounds like it should work. :)



来源:https://stackoverflow.com/questions/7806729/objective-c-adding-gps-information-to-a-photograph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!