我想从SKProduct获得价格等级,并从AppStore价格计算净收入。
例如,从0.99美元我得到0.7美元,从1.29澳元 - 0.82澳元。我可以通过编程方式进行计算吗?
答案 0 :(得分:1)
现在它看起来像这样:
var netRevenue = 0.0
switch currency
{
case "USD", "CAD", "NZD":
netRevenue = (price + 0.01) * 0.7
case "EUR", "DKK", "SEK", "GBP":
netRevenue = price * 0.70 / 1.15
case "AUD":
netRevenue = price * 0.70 / 1.11
case "CHF":
netRevenue = price * 0.70 / 1.08
case "NOK":
netRevenue = price * 0.70 / 1.25
case "ZAR":
netRevenue = price * 0.70 / 1.14
default:
netRevenue = 0.7 * price;
}
netRevenue.roundTo(".2")
//.roundTo
extension Double
{
mutating func roundTo(f: String)
{
self = NSString(format: "%\(f)f", self).doubleValue
}
}
答案 1 :(得分:0)
是的,你可以以编程方式计算它。您获得70%的收入,因此代码应为
float revenue = price * 0.7f