Adding metadata to iOS images the easy way

Email This Post Email This Post

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 I wanted to add this feature so that it could actually replace the built-in camera app. And since the built-in camera app adds geolocation, along with a lot of other metadata to the images, 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: https://github.com/gpambrozio/GusUtils. The repo contains an XCode project that should compile a nice static library for you to use on your projects. I plan on add a lot of utility classes here, so you might just want to pick and choose whatever you need to use instead of using the whole library.

The category is easy enough to use if you check out the code, but I’ll explain a few things on how to use it for those that never had to deal with image metadata on iOS before.

Who is this metadata person anyway?

For those of you that have no idea what I’m talking about, image metadata is most commonly known as EXIF data, even though that’s slightly wrong because EXIF data is only one type of metadata that can be embedded in an image file. My category deals with EXIF metadata, as well as with TIFF and 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:

- (void)writeImageToSavedPhotosAlbum: metadata: completionBlock: completionBlock

That takes a NSDictionary as the metadata source. What the documentation doesn’t explain (or at least I could not find) is how this dictionary should be. I googled a lot and found some examples online that I used as a starting point for the category (sorry, can’t remember most of them…).

Turns out that this dictionary consists of a lot of other NSDictionaries with key/values that are dependent on the type of metadata you’re adding. You can find all the dictionaries that go inside this dictionary (I know…. even I’m getting confused with so many dictionaries…) in the CGImageProperties Reference of the documentation.

I’ll try to explain with an example. Say you want to add a “Description” property in your image. This property sits inside the TIFF dictionary. So, in order to add this information to your metadata dictionary you can use this code:

NSMutableDictionary *tiffMetadata = [[NSMutableDictionary alloc] init];
[tiffMetadata setObject:@"This is my description" forKey:(NSString*)kCGImagePropertyTIFFImageDescription];
NSMutableDictionary *metadata = [[NSMutableDictionary alloc] init];
[metadata setObject:tiffMetadata forKey:(NSString*)kCGImagePropertyTIFFDictionary];

Why am I using NSMutableDictionary? Well, in this example you really don’t have to, but say you want to add another TIFF property to your metadata, with NSMutableDictionary you can just add another key/value to the tiffMetadata dictionary. If you used NSDictionary you’d have to create a new NSDictionary with the old key/values plus the new key/value. Not cool….

Adding geolocation is even harder. Geolocation has it’s own dictionary with a lot of possible values that are NOT explained in the documentation. The best information I found about this was in this StackOverflow question that I used as the basis for my implementation.

Please, help, I don’t want to do this…

The NSMutableDDictionary+ImageMetadata category takes all this complexity away from your code. To add geolocation to your metadata dictionary, all you have to do is this:

NSMutableDictionary *metadata = [[NSMutableDictionary alloc] init];
[metadata setLocation:location];

Where location is a CLLocation instance. That’s it. My category will create the appropriate dictionary and add it to your NSMutableDictionary with all the appropriate key/values. I’ve implemented some other interesting setters and there are some helper methods that make it very easy to add methods for other properties:

- (void)setLocation:(CLLocation *)currentLocation;
- (void)setUserComment:(NSString*)comment;
- (void)setDateOriginal:(NSDate *)date;
- (void)setDateDigitized:(NSDate *)date;
- (void)setMake:(NSString*)make model:(NSString*)model software:(NSString*)software;
- (void)setDescription:(NSString*)description;
- (void)setKeywords:(NSString*)keywords;
- (void)setImageOrientarion:(UIImageOrientation)orientation;

 

After setting all your properties, you can call ALAssetsLibrary’s – writeImageDataToSavedPhotosAlbum:metadata:completionBlock: or – writeImageToSavedPhotosAlbum:metadata:completionBlock:. using your very special NSMutableDictionary and you’re all set!

Getting metadata

There’s another hard to find issue with metadata and that’s getting it from an image you just took using UIImagePickerController or an AVCaptureStillImageOutput. I’ll deal with this problem in another post but rest assured that out friendly category will help you a lot too. (UPDATE: The reading part in on this blog post)

Can I use this?

Yes, use it, fork it, spread the word. And if you make any improvements to your fork, or if you found a bug or a better way to do things, please send me a pull request so that I can incorporate your improvements into the main branch.

And if you really want t help me out and get a nice app at the same time, get Snap for your iPhone. Best 2 bucks you’ll spend today!

Porn amateur webcam porn amateur webcam. Home treatment for bv infection home treatment for bv infection. Webcam free chat sex webcam free chat sex. New otc diet pill 2013 new otc diet pill 2013. Home cure for bv home cure for bv. Free cam shemales free cam shemales. Vitamin b hgh vitamin b hgh. Copper for arthritis pain copper for arthritis pain. Shemale live webcam free shemale live webcam free. Recovery after ruptured ovarian cyst recovery after ruptured ovarian cyst. Tinnitus inhibitor price tinnitus inhibitor price. Acai plants for sale uk acai plants for sale uk. Pcos stop hair loss pcos stop hair loss. Free acai berry trials australia free acai berry trials australia. Treating bv naturally treating bv naturally. Zovirax cream coupons zovirax cream coupons. Increase egg quality pcos increase egg quality pcos. Hemorrhoids delivery baby hemorrhoids delivery baby. Vaginitis holistic vaginitis holistic. Phentermine 37.5 mg tablets 90 phentermine 37.5 mg tablets 90. Stereo hearts piano sheet easy stereo hearts piano sheet easy. Bv wine prices bv wine prices. Arthritis pain lotion arthritis pain lotion. Hgh supplements research hgh supplements research. Ovarian cysts holistic approach ovarian cysts holistic approach. Lose weight at home lose weight at home. Cure teeth clenching cure teeth clenching. Best hair loss treatment men best hair loss treatment men. After hemorrhoid surgery pain after hemorrhoid surgery pain. Psoriasis under tongue psoriasis under tongue. How to get rid of ringing in ear how to get rid of ringing in ear. Piano wire breaking strain piano wire breaking strain. 100 pound weight loss stories 100 pound weight loss stories. Treat heartburn fast treat heartburn fast. Acai berry xtra reviews acai berry xtra reviews. Videos web cam porno videos web cam porno
Email This Post Email This Post

Apple App Store user review frustration

Email This Post Email This Post

No, it’s not another App Store rant

A lot has been said about Apple’s app store, the review process, the whole walled garden stuff, etc… As an iOS developer I feel this pain sometimes, especially when my apps go into that state of “waiting for review”, but I tend to take this as a side effect of a drug that makes more good than harm.

The fact is that Apple’s app store revolutionized the software industry and has changed the lives of a lot of independent developers that can now offer the fruits of their labor to millions of people. I know that I changed a lot in my life and, even if I still can’t rely only on my app sales, I have a firm belief that it will happen soon.

The Problem

But there’s one thing about Apple’s app store that I think needs changing and I have not read about it anywhere before: the user review process.

When something costs money, even when it’s under a dollar, people want some validation before buying it. And in the app store user reviews are a valuable source for this information. A lot of users (me included) read them before buying an app. I even do it for free apps sometimes so I don’t even waste my time on an app that has mostly bad reviews.

I got very lucky with Snap when I first released it. I had a nice review from AppAdvice and got featured by Apple in the new and noteworthy section of both the photography section and on the home page of iTunes in the US and some other countries. This gave me a lot of sales and a lot of happy customers. I had a lot of users asking for support but it was mostly feature suggestions or questions about using the app, but everybody was happy.

But then I received two user reviews that worried me. One said that the app didn’t work, that it was a rip off and the other said that the app locked in a screen with a “done” button (there’s no done button in my app…). I opened an issue using itunesconnect asking them to remove these two reviews, stating that I had more than 3000 sales and no complaints of this nature and NO done button but they replied saying that these reviews didn’t meet their standards for removal.

iTunes reviews

And to make matters worse, these two reviews got to the top of the list because a lot of people found them useful. Meaning two things: first, that people tend to “like” negative reviews more than positive ones; and second, a lot of people wouldn’t buy my app because they didn’t even see the lots of other good reviews I had.

So, at this point, there’s nothing I can do about this. These users could have sent me an email or clicked the support link that leads to a Zendesk site I use to provide support, but they didn’t. They just complained and gave me no way of helping them.

And that’s very frustrating. I really want to make this the best app I can make and I take user support very seriously but in this case there was nothing I could do. So, how can this be solved?

A suggestion

My suggestion would be to implement in itunesconnect a way for developers to reply to their customers. I don’t know exactly why Apple won’t give us these user’s emails, but let’s assume they have some valid reasons for this, like fearing that we can harass their users or try to bribe them to make them change their reviews. So, with an interface like this in itunesconnect we can send a message to these users without ever knowing their email. We write the reply and Apple sends an email to the user. The user can reply to this email and it would go back to itunesconnect without showing any emails.

And, as the whole process gets logged by Apple, they can give us some guidelines we’d have to follow, like never asking for an email or phone number. If a developer breaks these rules he gets banned from the app store or gets a warning about it. To help enforce these rules Apple can build some automated rules that “reads” the emails to try to determine if some rules are getting broken.

They could even give us a way to refund the customer automatically if we can’t resolve the issue for some odd reason. I would rather give a few bucks back to a user who’s unhappy with my app for some reason than have one unsatisfied cusomer giving me bad reviews.

Conclusion

I know that bashing Apple and the app store is very frequent among developers and bloggers but that’s not the case here. I believe Apple is doing a nice job with the whole iOS line and the app store and I’m happy to be able to be a part of it. But I believe the review process can be better and Apple can help us with a way to get in touch with our customers. I think it can even take some work off their own support staff that has to deal with a lot of refund requests and complaints about apps.

What do you guys think? Any other ideas?

Polycystic ovary treatments polycystic ovary treatments. Gynecomastia diet gynecomastia diet. Hair baldness treatment in urdu hair baldness treatment in urdu. Treating hair loss with birth control pills treating hair loss with birth control pills. Dating sites totally free dating sites totally free. Bv testing lab hk bv testing lab hk. Best treatment for thrombosed piles best treatment for thrombosed piles. Medicamentos para herpes genital hombres medicamentos para herpes genital hombres. Duromine usa duromine usa. Acai berry poop acai berry poop. Gynecomastia treatment through exercise gynecomastia treatment through exercise. Piano learn online piano learn online. Datingsites hoger opgeleiden belgie datingsites hoger opgeleiden belgie. Free live shemale sex cams free live shemale sex cams. Ionamin user reviews ionamin user reviews. Free cams tranny free cams tranny. Outside furniture jhb outside furniture jhb. Dating sites for single dating sites for single. 3 day weight loss diet 3 day weight loss diet. Youtube piano tutorials youtube piano tutorials. Stop thinking tinnitus stop thinking tinnitus. Galium aparine psoriasis galium aparine psoriasis. Flinter shipping bv fleet flinter shipping bv fleet
Email This Post Email This Post

That’s why I do what I do

Email This Post Email This Post

As a software developer I get a lot of pleasure when a code that I wrote, all those ifs and methods and classes, turns into a real thing, something on my computer screen, doing what I have summoned it to do.

But I get even more pleasure when I see someone using these things, when I meet someone that tells me how wonderful it is, when I see someone I never met before interacting with it with pleasure, when I see a kid using it so naturally.

And I thought it could not get better than this, but it can.

I released Snap a few weeks ago and I was getting some attention for it. AppAdvice already wrote a review of version 1.00 and when I released version 1.01 we decided to do a giveaway together.

Christine Chan asked her readers to describe in the comments how would they use Snap if they got the promo code and one guy caught my attention with something I never thought it would be used for:

James F Bagnell Jr MS
March 26, 2011 • 2:55 pm

“I am a behavioral specialist who works with Autistic children. As part of their Social Skills training I’ll use this app to take snap-shots of the items they use and the people they work with to set up a picture schedule that will lay out their daily routine (which always includes reading them the AppAdvice daily app). Since the parents of the children I work with are less fortunate, I try and make use of the resources I have available. Thanks for keeping me updated on new apps like this one! AppAdvice is the best.”


That really moved me. When the giveaway was over I asked Christine if this guy was one of the winners. If not I was gonna give him a promo code anyway. As it happens he was one of the winners and Christine was nice enought to send another email asking James to contact me, which he did the next day. I asked him if it was OK for me to write about it and he said yes.

Of all the uses I imagined for the app, using it to help autistic children was not one of them, so I was curious as to how it was being used to this end. James explain on another email:

“Autistic children learn in differing ways than those without. One of the ways I teach my clients is through the use of Social Scenarios. These are little homemade picture books that use photographs of everyday people, places, and events that Autistic children encounter throughout their day. One example (which I am working on right now) is a social story that lays out the daily schedule of one of my clients in order to help him transition. The first picture shows his alarm clock displaying the time he is to wake up. The next photograph shows his dresser and the heading reads “this is my dresser, I keep my clothes in here to wear. What will I wear today?”. This continues through the daily rituals of the child and helps him to transition better by understanding his expectations.”


I researched a bit and this is called “Social Stories“. According to wikipedia:

Social Stories are a concept devised by Carol Gray in 1991 to improve the social skills of people with autism spectrum disorders (ASD).
Social Stories are short stories written or tailored to an autistic individual to help them understand and behave appropriately in social situations. The stories have a specifically defined style and format.
They describe a situation in terms of relevant social cues, the perspective of others, and often suggest an appropriate response. They may also be used to applaud accomplishments; roughly 50% of all Social Stories are targeted to be used for this reason.


So, using Snap I took some pictures around my house and played with it a bit:

These were done using version 1.10 of Snap that’s waiting to be approved by Apple as I write this. Hopefully this new version will make the app even better for people like James. I think James might like the AirPrint capability of this new version. This might allow him to make his social scenarios even easier: just snap a picture, write what you want and send it to an AirPrint compatible printer.

Before Snap I didn’t know about Social Stories and had no idea Snap could be used to help autistic children. So now I’m wondering, what else is Snap being used to? The giveaway gave me a lot of examples that I haven’t thought of and I’m sure there’s a lot more uses for it that will never cross my mind.

And this is what I love doing what I do. The bits and bytes are just the raw material I use to build software that can be used by people in ways that are far beyond my imagination.

So, think you can do something cool with Snap that I haven’t thought of? Leave a comment and you might win a copy of Snap.

You can also discuss on HN, Digg or Reddit.

Tinnitus retraining therapy (trt) tinnitus retraining therapy (trt). Songs for beginners on piano songs for beginners on piano. Hyperhidrosis shop hyperhidrosis shop. Hair fall after transplant hair fall after transplant. Tube boy cam tube boy cam. Rosacea amino acid treatment rosacea amino acid treatment. Home remedies hemorrhoids treatment home remedies hemorrhoids treatment. Arthritis degenerative disk disease arthritis degenerative disk disease. Cold skin sweating cold skin sweating. Uterine fibroid reduction uterine fibroid reduction. Gay cam for iphone gay cam for iphone. Slimquick hoodia women results slimquick hoodia women results. Medicine herpes over counter medicine herpes over counter. Psoriasis stoppen met roken psoriasis stoppen met roken. Ladyboy webcam video ladyboy webcam video. Tinnitus holistic treatment tinnitus holistic treatment. 2013 gop candidates issue comparison 2013 gop candidates issue comparison. Plaque psoriasis treatment at home plaque psoriasis treatment at home. Porn tube cams porn tube cams. 30 x 40 shop plans 30 x 40 shop plans. Will help heartburn pregnancy will help heartburn pregnancy. Bv shipping benin bv shipping benin. Bv and fertility bv and fertility. Alternative health uterine fibroids alternative health uterine fibroids. Cam sex arab cam sex arab. How do i stop clenching my teeth in my sleep how do i stop clenching my teeth in my sleep. Hemorrhoids baby delivery hemorrhoids baby delivery. Flohwalzer piano tutorial flohwalzer piano tutorial. New diet pills 2014 uk new diet pills 2014 uk
Email This Post Email This Post