Code:
NSString *strDirect = @"Dummy\nMessage";
NSString *strBundle = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"MessageDummy"];
NSLog(@"Direct: %@", strDirect);
NSLog(@"Bundle: %@", strBundle);
where MessageDummy is a string type value Dummy\nMessage in the .plist file. i.e.:
<key>MessageDummy</key>
<string>Dummy\nMessage</string>
Output:
2010-08-09 11:49:18.641 Plan[15558:207] Direct: Dummy
Message
2010-08-09 11:49:18.642 Plan[15558:207] Bundle: Dummy\nMessage
\n is honored in NSString * but not when returned from objectForKey. How can I make the return value of objectForKey behaves same as the NSString *?
The problem is that while “\n” is treated as “\\n” while you are trying to retrieve it (\ is escaped with \\). The work around for this is, instead of using
use:
Hope this helps.