For example, why use this:
NSLocale *l = [[NSLocale alloc] initWithLocaleIdentifier@"en_US"];
Instead of something like this:
NSLocale *l = [[NSLocale alloc] initWithLocaleIdentifier:NSLocaleIdentifierUS];
It seems like it would prevent a lot of errors, as when typing an NSString in Xcode, there is no autocorrect, while Xcode will autocorrect/autofill enums. Additionally, I can't think of a reason to use NSStrings over enums or constants. For example, as new versions of the SDK are released, Apple can add new identifiers, but they can also do this with enums. Another benefit of enums over string constants is that enums can be compared more easily:
if(userIdentifier == NSLocaleIdentifierUS) {
//English!
}
Also, for other methods, Apple uses enums or specific objects as parameters:
NSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding];
If they use a string for localeIdentifier, why not do this:
NSData *data = [aString dataUsingEncoding:@"ascii"];
It seems like they are simply being inconsistent.