Here's a code of how I get currency symbol now:
NSLocale *lcl = [[[NSLocale alloc] initWithLocaleIdentifier:@"au_AU"] autorelease];
NSNumberFormatter *fmtr = [[[NSNumberFormatter alloc] init] autorelease];
[fmtr setNumberStyle:NSNumberFormatterCurrencyStyle];
[fmtr setLocale:lcl];
NSLog( @"%@", [lcl displayNameForKey:NSLocaleCurrencySymbol value:@"AUD"] );
NSLog( @"%@", [fmtr currencySymbol] );
Both NSLogs return "AU$". As I understood from Apple development documentation, there are at least two currency symbols for each currency (these symbols could be the same, though) - local (that is used within a country. $ for Australia, for example) and international (AU$ for Australia). So, the question is how to get LOCAL currency symbol. Any ideas?
Thanks in advance.
This snippet returns the currency symbol ¥ for locale "ja_JP" (could be any other locale).
It's unfortunate that for au_AU you get AU$ as the local currency symbol instead of just $, but that must be the way it's meant to be displayed on iOS. However note that the international symbol printed for au_AU is not AU$ but AUD.
It's not ideal in that it's not coming out of the system, but obviously you could create your own internal table using a list of current currency symbols*. Since that list has the unicode symbols for it it would simply be a matter of matching up the Apple list of locales with the list.
Y'know, just in case the Apple-provided ones aren't actually accessible.
*Note: link not intended to be authoritative, see comments.
Swift version, code adapted from Valentyn's answer (tested on Swift 4.1):
It gives a decent result, although it doesn't change the position of the currency symbol correctly for all locales, despite what is written in the original answer. But that's the way Apple wants it to be, so be it.
The Australian dollar is displayed as the original question enquires, as "$1.50".
Could you could get the current string and strip it of all a-Z characters? If the resulting string has length > 0 then you've got your symbol. Otherwise use the original string.
It's tacky and I'm not sure if this would work for all currencies worldwide but it might work?
You will receive $5.00 for US, ¥5.00 for Japan, 5.00€ for Europe, etc.
Your code should work, however the locale identifier is wrong. It should be "en_AU".
See "Using the Locale Object" in the "Internationalization and Localization Guide" (https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/InternationalizingLocaleData/InternationalizingLocaleData.html#//apple_ref/doc/uid/10000171i-CH13-SW4)