更新应用内购买价格 [英] Updating price of in app purchase

查看:72
本文介绍了更新应用内购买价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中弹出一个自定义警报视图,询问用户是否要购买我的应用程序购买之一.在警报视图中,我还列出了我从与之关联的SKProduct中得出的应用内购买价格.

I have a custom alert view that pops up in my app asking the user if they'd like to purchase one of my in app purchases. In the alert view, I also list the price of the in app purchase which I derive from the SKProduct associated with it.

问题是,现在我想更改应用程序内购买的价格,但是当应用程序在应用程序委托中启动时,我正在收集产品数据,那么我该如何处理呢? (是否仅在用户首次启动应用程序时启动应用程序委托?).

The thing is, now I want to change the price of my in app purchase, but I'm collecting the product data when the app launches in the app delegate, so how should I go about this? (does the app delegate only launch when the first time the user launches the app?).

每次显示对话框时,是否需要查询Apple以重新加载产品数据?听起来真的效率很低...

Each time I display the dialogue, do I need to query Apple to reload the products data? That sounds really inefficient...

如果有机会更新一次应用内购买的价格,是否会提醒SKProductsRequestDelegate以便它会自动更新您的产品?

By chance, if you update the price of one of your in app purchases, will the SKProductsRequestDelegate be alerted so it will update your products automatically?

有人能很好地解决这种情况吗?

Does anyone have a good solution to this situation?

推荐答案

看来,解决此问题的最佳方法是在应用启动时加载产品,并在每次激活时重新加载产品.在应用程序委托中实现以下方法可解决此问题:

Seems the best way to remedy this situation is to load the products when the app launches and reload the products every time the app becomes active. Implementing the following method in the app delegate takes care of the problem:

- (void) applicationWillEnterForeground:(UIApplication *)application
{
    [self loadProducts];
}

- (void) loadProducts
{
    self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObjects: MyProduct1, MyProduct2 nil]];
    self.productsRequest.delegate = self;
    [self.productsRequest start];
}

这篇关于更新应用内购买价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆