How to get SKProduct local price in US Dollar?

喜夏-厌秋 提交于 2019-12-11 01:13:20

问题


I need to convert SKProduct local price to US Dollar. That means, SKProduct give me local based currency. But i need to show US Dollar rate in every country.


回答1:


Try these libraries DDUnitConverter and MGCurrencyExchanger or try this code

SKProduct *product = [self.products objectAtIndex:indexPath.row];
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setLocale:product.priceLocale];
currencyString = [formatter stringFromNumber:product.price];`


来源:https://stackoverflow.com/questions/46658966/how-to-get-skproduct-local-price-in-us-dollar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!