Susann Schulz
Susann Schulz

Reputation: 73

How to ad local currency symbol - ios in app purchase

How can I add the local cyrrency symbol to the Buy-Button from https://github.com/ebutterfly/EBPurchase

[buyButton setTitle:[@"Buy Game Levels Pack " stringByAppendingString:productPrice] forState:UIControlStateNormal];

Upvotes: 1

Views: 1420

Answers (1)

rmaddy
rmaddy

Reputation: 318934

Code like the following will work:

SKProduct *product = ebp.validProduct; // epb is the EBPurchase object
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
NSString *formattedPrice = [numberFormatter stringFromNumber:product.price];

formattedPrice will have the appropriate currency formatting.

You should also use the localizedTitle and localizedDescription from product for the product's title and description. This is all obtained from the data you setup in iTunes Connect.

Upvotes: 7

Related Questions