Search code examples
iosnsnumberformatter

NSNumberFormatter not displaying rupee symbol only on ipad device


I am using an NSNumberFormatter with NSNumberFormatterCurrencyStyle to display in app purchas prices in my universal iOS app. My location is India, and the formatter correctly displays the indian rupee symbol in most devices I tested (ipad simulator, ipad 3 device, iphone 3gs device, iphone 4 device). However, only on the ipad first generation (running iOS 5.1.1), it displays a square instead of the rupee symbol.

All devices are running the latest ios that they support (iOS 6.0.1 on ipad 3, iphone 4 and iphone 3gs; iOS 5.1.1 on iPad 1).

The function we use to format the currency is:

@implementation SKProduct (LocalizedPrice)

- (NSString *)localizedPrice
{
    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
    [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
    [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
    [numberFormatter setLocale:self.priceLocale];
    NSString *formattedString = [numberFormatter stringFromNumber:self.price];
    [numberFormatter release];
    return formattedString;
}

@end

Update1: This seems to happen only on iOS 5.1 and not on iOS 6.0 - I tried running on ipad simulator on ios 6 and on ios 5.1 - it works on ios 6 simulator but not on ios 5.1. Is there a way to display the currency symbol on ios 5.1?

Update2: For now, I check for OS version and display the symbol only in >= 6.0. This is what some of the other apps out there seem to be doing.

Thanks Anand


Solution

  • If this isn't working on a specific version of iOS or device you should file a radar.

    Apple Bug Reporter