如何从 https://github.com/ebutterfly/EBPurchase将本地货币符号添加到 Buy-Button
[buyButton setTitle:[@"Buy Game Levels Pack " stringByAppendingString:productPrice] forState:UIControlStateNormal];
如何从 https://github.com/ebutterfly/EBPurchase将本地货币符号添加到 Buy-Button
[buyButton setTitle:[@"Buy Game Levels Pack " stringByAppendingString:productPrice] forState:UIControlStateNormal];
如下代码将起作用:
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
将具有适当的货币格式。
您还应该使用localizedTitle
and localizedDescription
fromproduct
作为产品的标题和描述。这都是从您在 iTunes Connect 中设置的数据中获得的。