"A" vs. "An" in writing vs. pronunciation

The choice of a vs. an is actually based on the phonetics of the start of a word, not the orthographic representation. This is why you say things like an honorable solider (the h is silent, so phonetically it begins with the vowel sound). Similarly, you would say a one-eyed pirate as one phonetically begins with the w sound.

So in the case of your example, it would be an NSString since phonetically it's en-es-string.