我想从SKProduct获取价格等级,并从AppStore价格计算净收入。

例如,从0.99美元起,我得到0.7美元,从1.29澳元-0.82澳元。我可以通过编程方式进行计算吗?

最佳答案

现在看起来像这样:

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
    }
}

10-08 14:43