我有一个iOS应用程序使用在应用程序购买,以迎合国际观众,所以我预计在不同的货币(美元,欧元,人民币,...您可以从AppStore定价矩阵中了解它们)。当然,我希望用用户的本地货币显示要购买的商品,但我真的不知道怎么做。
使用用户的地区或语言似乎不是一个好的指标,因为货币取决于用户使用的AppStore帐户的地区,而不是设备设置。
如何知道用户将使用哪种货币进行支付?
发布于 2012-02-23 00:11:09
一旦获取了SKProduct对象,就可以从价格和priceLocale属性构造其本地化价格。下面是从apple docs复制粘贴的方法:
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
NSString *formattedString = [numberFormatter stringFromNumber:product.price];https://stackoverflow.com/questions/9398423
复制相似问题