-2

I'm creating a NSError like this:

    NSMutableDictionary* details = [NSMutableDictionary dictionary];
    [details setValue:@"REQUEST_UNKNOWN_CONVERT_FOR_ENDPOINT" forKey:NSLocalizedDescriptionKey];
    NSError * error = [NSError errorWithDomain:DOMAIN code:200 userInfo:details];

where REQUEST_... is my key in my translation file (Localizable.strings).

when I get an error I try to print it like this:

  NSLog(@"%@", [error localizedDescription]);

It just prints my REQUEST_UNKNOWN...(my key) out instead of my translation.

Am I doing something wrong?

Reconquistador
  • 885
  • 8
  • 28
user1007522
  • 7,858
  • 17
  • 69
  • 113

1 Answers1

4
[details setObject:NSLocalizedString(@"REQUEST_UNKNOWN_CONVERT_FOR_ENDPOINT", Nil) forKey:NSLocalizedDescriptionKey];

You have to put value as localizedString, while you are adding it as standard NSString.

Reconquistador
  • 885
  • 8
  • 28
  • Here is the answer: http://stackoverflow.com/questions/1249634/wheres-the-difference-between-setobjectforkey-and-setvalueforkey-in-nsmutab – Reconquistador Jul 17 '14 at 11:38