Pregunta

I have a problem retrieving my locale currency symbol.

NSString *currencySymbol = [[NSLocale currentLocale]
                                   objectForKey:NSLocaleCurrencySymbol];

I was expecting the £, instead I still get the $.

In my system settings the region is already set to United Kingdom.

What am I missing please?

UPDATE: I just realised, if I deploy the app on the iPhone, the symbol shows correctly. It is only the simulator that still shows the Dollar sign instead of the Pound.

¿Fue útil?

Solución

Alright, I found the answer. I was expecting the simulator to retrieve the locale of my Mac which is United Kingdom. However the simulator is completely isolated in its own sandbox.

Hence you need to change the settings on the simulated iPhone to United Kingdom. Then you have to kill the application process in the simulated iPhone itself and restart the application. Surprisingly the simulator keeps the new iPhone settings after a restart.

Now it works. I hope this helps someone else with a similar problem.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top