应用内购买最佳实践:如何使用下载的内容

发布于 2024-12-02 05:09:18 字数 356 浏览 3 评论 0原文

问题的简单示例: 我有一个可以通过应用内购买下载背景的应用程序。 所以我下载图像(或压缩图像)。 现在我的 iPhone 上已经有了它...我的应用程序如何知道图像的名称并可以加载为游戏背景?

我想到的是image+downloaded.plist的zip; download.plist 是一个文件名,其中包含我下载的内容的名称,因此我的应用程序加载该 plist(我知道该名称,因为它始终相等),然后其余的... 但现在我必须将该信息保存在另一个包含下载的所有附加组件的本地 plist 中...

这是一个非常基本的示例,但我可以在未来加载级别、字符...所以我想知道如何组织工作使其尽可能更通用......

实现这一目标的标准方法是什么? 谢谢

simple example of the problem:
i have an app that can download backgrounds from in-app purchase.
so i download images (or a zipped image).
now that i have it on my iphone...how can my app knows the name of the image and can load as background of the game?

what i have thought is zip of the image+downloaded.plist;
downloaded.plist is a filename that contains the name of what i have downloaded, so my app loads that plist (i know the name because is always equal) and then the rest...
but now i have to save that information in another local plist that contains all add-on downloaded...

this is a very basic example, but i can in future load levels, character...so i'd like to know how to organize work to have it more general as possible...

what is the standard method to make this?
thanks

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

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

发布评论

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

评论(1

孤凫 2024-12-09 05:09:18

我不太确定我理解你的问题,但这里有一些想法。

当用户使用 iap 购买商品时,您就知道关联的产品 ID。这样,您就可以映射到用户购买的实际物品(无论​​是图像、关卡、现金还是其他)。因此,您应该使用产品标识符来了解要提供给用户的信息。

看来您在这里处理的是非消耗品。如果您将应用程序与捆绑包中的产品一起发布,则可以使用产品 ID 解锁它们(正如您所说,您需要维护已解锁文件的列表)。如果你需要下载产品,这里同样适用,你需要使用id来知道要下载哪个文件。

为了组织工作,我将实现一个商店对象,该对象处理商店工具包,根据所做的交易加载产品,将它们提供给用户,维护所有必要的东西等。您可以将此方法扩展到一组类如果需要的话。

顺便说一句,对于非消耗性产品,您应该在服务器上执行几项操作,例如维护用户购买的产品列表、验证等。您可以在 Apple 的应用内购买编程指南中阅读相关内容。

我希望这能回答你的问题。

干杯

I am not quite sure I understood your question, but here are some thoughts.

When the user buys something using iap, you know the associated product id. With that, you can map to the actual thing the user has bought (whether it is an image, a level, cash, whatever). So, you should use the product identifier to know that to give to the user.

It seems you are dealing with non-consumable products here. If you ship your app with the products inside the bundle, you can unlock them using the product id (As you said, you need to maintain a list of the unlocked files). If you need to download the products, the same applies here, you need to use the id to know which file to download.

To organize work, I would implement a store object that deals with the store kit, loads the products according to the transactions made, gives them to the user, maintains all the necessary stuff, etc. You can escale this approach to a set of classes if necessary.

On a side note, for non consumable products, you should perform several things on a server, e.g. maintain the list of products the user bought, validations, etc. You can read about this in the in-app purchases programming guide from Apple.

I hope this answers your question.

Cheers

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