使用 MKStoreKit 实现动态服务器产品列表?

发布于 2025-01-04 10:42:26 字数 347 浏览 0 评论 0原文

我在我的应用程序中实现 MKStoreKit,但应用程序的性质是,它将需要支持对应用程序内购买的可用(非消耗)产品列表进行频繁、动态的更改。因此,我需要能够定期查询我们的服务器以获取当前可用产品 ID、描述等的列表。

据我所知,MKStoreKit 仅支持可用产品的静态 plist,这意味着我们必须每次我们需要更改 IAP 产品列表时,都会发布应用程序更新。正如我所提到的,这项服务不可能做到这一点。

有谁知道如何使用 MKStoreKit 从服务器下载更新我们的 IAP 产品列表,而不需要更新应用程序。

如果没有,我必须想象有人修改了代码来支持这一点。如果是这样,所获得的任何提示和智慧将不胜感激。

提前致谢。

I'm implementing MKStoreKit in my app, but the nature of the app is such that it will need to support frequent, dynamic changes to the list of available (non-consumable) products for in app purchase. Thus, I need to be able to regularly query our server for the current list of available product IDs, descriptions, etc.

As far as I can figure, MKStoreKit only supports a static plist of available products, which would mean we'd have to release an app update every time we need to change our IAP product list. As I've mentioned, this is not possible with this service.

Does anyone know of a way to update our IAP product list by downloading it from the server, without requiring an app update, using MKStoreKit.

If not, I have to imagine there are people out there who have modified the code to support this. If so, any tips and wisdom gained would be MUCH appreciated.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稀香 2025-01-11 10:42:26

据我所知,MKStoreKit 在 MKStoreManager.m 的以下方法中以 plist 形式检索产品列表:

#pragma mark Internal MKStoreKit functions
//line 201 of MKStoreManager.m

- (NSDictionary*) storeKitItems
{
  return [NSDictionary dictionaryWithContentsOfFile:
          [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]];
}

因此,如果您只是更改此方法调用,例如,获取新的从您的服务器中获取项目,您就可以达到您需要的结果。

例如,您可以有一些预先填充的 .plist,然后将其移动到 NUSUserDefaults,就像 NSDictionary 一样,并且当来自服务器的新项目到来时,您只需更新它即可。

所以,你的方法看起来像这样:

- (NSDictionary*) storeKitItems
   {
     if(![[NSUserDefaults standardUserDefaults]valueForKey:@"NewConfigs"])
             [[NSUserDefaults standardUserDefaults]setValue:[NSDictionary dictionaryWithDictionary:[NSDictionary dictionaryWithContentsOfFile:
                                                                                                           [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]]] forKey:@"NewConfigs"];
 [[NSUserDefaults standardUserDefaults]synchronize];

 return [[NSUserDefaults standardUserDefaults]valueForKey:@"NewConfigs"];
    }

As far as i can see, MKStoreKit retrieves the list of your products as a plist in the following method of MKStoreManager.m:

#pragma mark Internal MKStoreKit functions
//line 201 of MKStoreManager.m

- (NSDictionary*) storeKitItems
{
  return [NSDictionary dictionaryWithContentsOfFile:
          [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]];
}

So, if you just change this method call, for example, to get the new item from your server, you can achive the result you need.

For example, you could have some prepopulated .plist, and then move it NUSUserDefaults, just like an NSDictionary, and, when the new items from Server come, you just update it.

So, your method would look something like this:

- (NSDictionary*) storeKitItems
   {
     if(![[NSUserDefaults standardUserDefaults]valueForKey:@"NewConfigs"])
             [[NSUserDefaults standardUserDefaults]setValue:[NSDictionary dictionaryWithDictionary:[NSDictionary dictionaryWithContentsOfFile:
                                                                                                           [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MKStoreKitConfigs.plist"]]] forKey:@"NewConfigs"];
 [[NSUserDefaults standardUserDefaults]synchronize];

 return [[NSUserDefaults standardUserDefaults]valueForKey:@"NewConfigs"];
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文