ios - iOS 中每个国家/地区的 IAP 定价不同

标签 ios appstore-approval storekit

我注意到,与其他国家/地区相比,我在中国为我的一款应用购买 IAP 的百分比非常低。我的结论是因为价格太高了。我希望能够为每个国家/地区的 IAP 实现不同的价格等级(然后首先专门针对中国)。我知道有这些特殊价格等级(A 级、B 级、替代 4 级……),它们已经为“新兴国家”提供了一些更便宜的价格,但它们不会这样做。

我所有的 IAP 都是非消耗品。

经过研究,这是我的想法:

  1. 在 itunes 门户中为每个 IAP 定义一个普通且便宜的 IAP。
  2. 当通过应用中的 StoreKit API 请求信息时,我会请求每个 IAP 的两个“变体”
  3. 返回的 SKProduct.priceLocal.regionCode 可以告诉我用户是否在中国,在这种情况下我会选择采用 IAP 的廉价变体(在应用中实现的逻辑)。

这是一个好方法吗? 苹果允许这种策略吗?

最佳答案

上述方法有效,我的应用程序已推送到AppStore;让我们看看它是否得到苹果的批准。

我的实现细节,以连接到中国 AppStore 的人以折扣价购买汽车为例:

class IAPManager : NSObject, SKProductsRequestDelegate, SKPaymentTransactionObserver {

    //holds the literal string identifiers as also entered in the itunes connect portal for the in app purchases
    //the format of this string can be anything you want. I use a revers domain notation to make it "unique".
    //notice that we are requesting the price for a car, there are 2 prices the "normal" price and the "discount" price
    //the idea is that we will offer the "discount" price for people connected to the Chinese AppStore
    struct ProductIdentifiers {
        static let carNormalPricing   = "net.fantastic.car._normalpricing"
        static let carDiscountPricing = "net.fantastic.car._discountpricing"
    }


    //stores the product request send to the AppStore for retrieving the pricing info
    //as stated in the Apple documentation this should be kept in memory until the request completes
    private var productRequest: SKProductsRequest?

    //once the pricing is retrieved from the AppStore its stored here
    private var carPrices: (normal: SKProduct?, discount: SKProduct?)

    //this is where the "magic" happens, pleople connecting to the Chinese app store get the discount pricing
    //all others get then normal pricing. By changing the "zh" you can select different stores...
    //I have tested this and this does work (for China anayway).
    var carPriceToUse: SKProduct? {
        //if we don't have normal pricing no pricing available at all!
        guard let normal = carPrices.normal else {
            return nil
        }
        //if we don't have any discount pricing always use the normal of course
        guard let discount = carPrices.discount else {
            return normal
        }
        //we got both prices so select between them
        //for chinese languages we use discount pricing
        if discount.priceLocale.languageCode == "zh" {
            return discount
        }
        //if not go for normal pricing
        return normal
    }

    func askAppStoreForCarPrices() {
        //make list of the product ids that we will be retrieving from the AppStore
        var productIds = Set<String>()
        //we want to get the norma and discount pricing for our car
        productIds.insert(ProductIdentifiers.carNormalPricing)
        productIds.insert(ProductIdentifiers.carDiscountPricing)
        //make and sendout the request (on main queue)
        productRequest = SKProductsRequest(productIdentifiers: productIds)
        productRequest?.delegate = self
        DispatchQueue.main.async(){
            [weak self] in
            self?.productRequest?.start()
        }
    }

    func buyCar() {
        //only if I can buy...
        guard let storeProduct = carPriceToUse else {
            fatalError("Asked to buy but no prices loaded yet")
        }
        //ask to buy
        DispatchQueue.main.async(){
            let payment = SKPayment(product: storeProduct)
            SKPaymentQueue.default().add(payment)
        }
    }

    //MARK: - SKProductsRequestDelegate, SKPaymentTransactionObserver


    func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
        //parseout any priceinfo
        for product in response.products {
            if product.productIdentifier == ProductIdentifiers.carNormalPricing {
                carPrices.normal = product
            }
            if product.productIdentifier == ProductIdentifiers.carDiscountPricing {
                carPrices.discount = product
            }
        }
    }

    func request(_ request: SKRequest, didFailWithError error: Error) {
        //...handle error when retrieving prices here...
    }

    func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        //..handle actual buying process here
    }

}

关于ios - iOS 中每个国家/地区的 IAP 定价不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45252977/

相关文章:

iphone - StoreKit:捕获失败的恢复?

ios - 将 iOS 应用程序提交到 App Store 进行审核而不将服务器更新推送到生产环境

iphone - 应用内购买我们可以退款吗

objective-c - 如何在iOS中查看用户最初安装的应用程序版本

ios - NSLocale.current.language 返回错误值

iPhone 应用程序上传问题

iphone - 我的客户是否需要开发者帐户才能将我制作的应用程序提交到 App Store?

ios - SwiftUI View 中的 StoreKit 委托(delegate)/可观察对象

ios - UIAlertView 的大小限制

ios - 当我使用 Storyboard id 时如何将数据传递到目标 View ?