简体   繁体   English

SwiftyStoreKit 和 AppStore Connect 版主的应用内购买问题

[英]In-app purchases trouble with SwiftyStoreKit and AppStore Connect moderator

I'm newbie with in-app purchases and SwiftyStoreKit.我是应用内购买和 SwiftyStoreKit 的新手。

I made an in-app purchases in my app and sent it for moderation.我在我的应用程序中进行了应用程序内购买并将其发送以进行审核。

My application moderator rejected and wrote the reason:我的申请版主拒绝了并写下了原因:

We found that your in-app purchase products exhibited one or more bugs when reviewed on iPhone and iPad running iOS 14.1 on Wi-Fi.我们发现,在通过 Wi-Fi 运行 iOS 14.1 的 iPhone 和 iPad 上查看时,您的应用内购买产品存在一个或多个错误。

Specifically, your app's In-App Purchases do not show the app's price.具体来说,您应用的应用内购买不会显示应用的价格。 Also, upon further review, we found that your app does not allow users to purchase the In-App Purchases.此外,经过进一步审查,我们发现您的应用不允许用户购买应用内购买。

Next Steps下一步

When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple's test environment.在您的服务器上验证收据时,您的服务器需要能够处理生产签名的应用程序从 Apple 的测试环境中获取其收据。 The recommended approach is for your production server to always validate receipts against the production App Store first.推荐的方法是让您的生产服务器始终首先针对生产 App Store 验证收据。 If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead.如果验证失败并显示错误代码“生产中使用的沙盒收据”,您应该改为针对测试环境进行验证。

The price was not displayed probably because the application received the answer code: "skerrordomain code=0" or something like that.价格没有显示可能是因为应用程序收到了应答代码:“skerrordomain code=0”或类似的东西。 Or because the Apple server returned 0 products.或者因为苹果服务器返回了 0 个产品。

That is, when ViewController starts, app request the price of the products from the Apple server and then write it down to the buttons.即当ViewController启动时,app向Apple服务器请求产品的价格,然后将其写到按钮上。

I don't know exactly what the problem is, because on my local device purchases work with a Sandbox user.我不知道到底是什么问题,因为在我的本地设备上购买的是沙盒用户。 In Simulator I get an error: "skerrordomain code=0".在模拟器中,我收到一个错误:“skerrordomain code=0”。

Here is a code sample:这是一个代码示例:

enum RegisteredPurchase: String {
    case item1 = "com.app.appname.item1"
    case item2 = "com.app.appname.item2"
    case item3 = "com.app.appname.item3"
}

purchases: [RegisteredPurchase]

var productList: Set<String> = []
for purchase in purchases {
    productList.insert(purchase.rawValue)
}
SwiftyStoreKit.retrieveProductsInfo(productList) { result in
    var products: Dictionary<RegisteredPurchase, String> = [:]
    for product in result.retrievedProducts {
        products[RegisteredPurchase(rawValue: product.productIdentifier)!] = product.localizedPrice
    }
    if (result.error == nil) {
        self.setupPrice(products)
    }
    
}

In the result I get retrievedProducts.结果我得到了检索产品。 On the local device all 3 products come, in Simulator I get 0 and the error.在本地设备上,所有 3 个产品都出现了,在模拟器中我得到 0 和错误。

通过删除所有产品并创建新产品来修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM