I want to change the currency symbols in iPhone app based on user's localization. If my app is working in US i need to change the currency symbol "$". If the app is working in Eroupe countries, we need to change the symbol to "€", if the app is in Japan, the symbol should be change to "¥" and if the app is running in Australia the symbol should be in "$". By this way if the app is running in any country the app should be change the currency sign based on the localizations. I have used this below code but, it always shows in "$". How can i solve this? And also how can i test this? Please help me.
NSNumberFormatter *currencyFormat = [[NSNumberFormatter alloc] init];
NSLocale *locale = [NSLocale currentLocale];
[currencyFormat setNumberStyle:NSNumberFormatterCurrencyStyle];
[currencyFormat setLocale:locale];
NSLog(@"Amount with symbol: %@", [currencyFormat stringFromNumber:@"10.00"]);
Please help me. Where i am wrong? Thanks in advance.
The simulator has support for changing localizations, just like on a regular device. Make sure that you change that before starting your app and it should show the correct format.
To change the locale (on the simulator):
Start the simulator (by starting your app), press the
Home
button, go toSettings
,General
,International
and then choose theRegion Format
you want to test. Close the simulator after it's done and restart your app. The locale has changed so you should see that in the currency symbol that is shown.On real devices you follow the same route to change the locale.