Add a localizedPrice method to SKProduct
| Originator: | dlreese | ||
| Number: | rdar://17181284 | Date Originated: | |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | |
| Classification: | Enhancement | Reproducible: |
Every piece of documentation, and in every WWDC session, that covers the topic of showing prices for in-app purchases shows or covers the following bit of code on how to do this “right”. Just make it a method on SKProduct already. :)
- (NSString *)localizedPrice
{
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
numberFormatter.locale = self.priceLocale;
return [numberFormatter stringFromNumber:self.price];
}
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!