Reading the GPS data from the image returned by the camera in iOS iphone

后端 未结 9 1325
余生分开走
余生分开走 2020-11-29 21:36

I need to get the GPS coordinates of an image taken with the iOS device\'s camera. I do not care about the Camera Roll images, just the image taken with UIImagePickerControl

9条回答
  •  情歌与酒
    2020-11-29 22:08

    Can't say I've needed to do exactly this in my own stuff, but from the docs it seems pretty clear that if you're using UIImagePickerController you can get the image that the user just took from the -imagePicker:didFinishPickingMediaWithInfo: delegate method. Use the key UIImagePickerControllerOriginalImage to get the image.

    Once you've got the image, you should be able to access its properties, including EXIF data, as described in QA1654 Accessing image properties with ImageIO. To create the CGImageSource, I'd look at CGImageSourceCreateWithData() and use the data that you get from the UIImage's CGImage method. Once you've got the image source, you can access the various attributes via CGImageSourceCopyProperties().

提交回复
热议问题