Warning: Rookie post
This is my first post for AltDevBlogADay so be gentle. I hope I can make you guys come back for more. I’ll visit my blog and subscribe.
Does it have to be so hard?
Are you writing a camera app or image editing app for iOS but are clueless on how to add geolocation to your pictures? Baffled by the lack of information in the otherwise very thorough XCode documentation? I feel your pain my friend. Or actually, felt, cause I got your meds right here.
When developing Snap had to do this too.
I present to you my NSMutableDictionary category that will solve all your problems. Ok, maybe not all, but the ones related to image metadata on iOS anyway.
For those with no patience, here’s the GitHub repo: IPTC metadata, depending on what kind of information you want to add to the image.
For example, the Original Date of an image can be embedded inside an EXIF property or inside a TIFF property. My category knows this and if you want to embed this date it will set both properties for you.
You can see all this metadata using most image viewers. On OSX, if you press cmd-i on the Preview app you can see an image’s metadata.
How does it work on iOS?
iOS SDK 4.1 introduced some methods that allowed an app to write image metadata in an image. One example is ALAssetsLibrary’s: