1

如何从 https://github.com/ebutterfly/EBPurchase将本地货币符号添加到 Buy-Button

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

1 回答 1

7

如下代码将起作用:

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将具有适当的货币格式。

您还应该使用localizedTitleand localizedDescriptionfromproduct作为产品的标题和描述。这都是从您在 iTunes Connect 中设置的数据中获得的。

于 2012-11-23T01:22:12.623 回答