InApp购买产品价格

问题描述 投票:0回答:1

我正在尝试在InApp购买中读取产品的价格。我想要美元价格,但收到当地货币INR。我想显示每个国家的美元价格。

let product = SKProduct()// my product object
 let price = product.price // receives always in INR

感谢您的任何帮助

ios swift in-app-purchase
1个回答
0
投票

应用购买价格的形式取决于您是从App Store帐户登录的本地用户。您可以检查语言环境

    let locale = Locale.current
    let currencySymbol = locale.currencySymbol!
    let currencyCode = locale.currencyCode!

您可以作为此委托方法检查的产品价格

//SKProductsRequestDelegate

 public func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
    print("Loaded list of products...")
    let products = response.products
    productsRequestCompletionHandler?(true, products)
    clearRequestAndHandler()

    for p in products {
        print("Found product: \(p.productIdentifier) \(p.localizedTitle) \(p.price.floatValue)")
        print("product price --%@",p.price)
    }


}
© www.soinside.com 2019 - 2024. All rights reserved.