in-app-purchase - 在应用购买成功后存储购买数据(osx 应用商店应用)

标签 in-app-purchase mac-app-store

使用我帖子底部的链接,我为我的 OSX 应用程序构建了一个基本的应用程序内购买。基本上我所做的是向用户显示一个用户界面,让他们选择他们想要购买升级(这只是添加更多内容),然后我通过调用 addPayment: 开始交易,我在 paymentQueue:updatedTransactions 中收到交易:和如果是购买交易,我将其发送到提供内容的方法,然后调用 finishTransaction:。

这一切都在应用程序的一次使用中起作用,但是当我再次启动时,我必须再次购买才能重新启用这些功能(这是有道理的,因为我没有将升级数据存储在任何地方),但我想知道存储有关购买的数据以防止用户在已经购买后再次被要求购买的最佳方式是什么。这是否应该通过收据验证来完成?我发现的所有文档都没有谈到这一点。

有用的网址:

In app Purchase walkthrough

Apple's in app purchase documentation

编辑:

我的应用实际上只是试图通过应用内购买来启用内置内容,所以苹果建议使用属性列表:

Apple recommends using a property list (plist) to track product identifiers for your built-in features. Content-driven applications can use this to add new content without modifying the source for your application.



但是我想知道如果 plist 文件存储在捆绑包中,我该如何编辑它(这导致沙盒认为应用程序已被入侵)。您是否将首选项 plist 存储在容器中?苹果提供的链接应该讨论更多关于更改应用程序首选项链接到 IOS 页面的信息,并且该页面上唯一关于首选项的内容是在设置包中。
Implementing Application Preferences”

应用程序偏好方法是否只能在 IOS 上使用?将升级数据放在设置包中的正确位置是否正确?

最佳答案

对于启用附加内容的购买,Apple 建议使用基于服务器的收据验证设置,如下所述:
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/APIOverview/OverviewoftheStoreKitAPI.html#//apple_ref/doc/uid/TP40008267-CH100-SW12

"Apple recommends you retrieve product identifiers from your server, rather than including them in a property list. This gives you the flexibility to add new products without updating your application.

In the server model, your application retrieves the signed receipt associated with a transaction and sends it to your server. Your server can then validate the receipt and decode it to determine which content to deliver to your application. This process is covered in detail in “Verifying Store Receipts.”

The server model has additional security and reliability concerns. You should test the entire environment for security threats. Secure Coding Guide provides additional recommendations.

Although non-consumable products may be recovered using the built-in capabilities of Store Kit, non-renewing subscriptions must be restored by your server. You are responsible for recording information about non-renewing subscriptions and restoring them to users. Optionally, consumable products could also be tracked by your server. For example, if your consumable product is a service provided by your server, you may want the user to retrieve the results of that request on multiple devices."


您可以为用户创建一个 UUID 并将其存储在应用程序的首选项中。这样做的好处是,当用户备份或恢复他们的设备时,uuid 会被备份。如果它是一个通用应用程序,它也可以很容易地在 iCloud 上同步。然后,服务器可以将该 UUID 链接到所进行的购买并交付该用户购买的内容。您可能希望包含额外的安全协议(protocol)以减少不道德用户的任何 UUID 欺骗,但除非内容非常有值(value),否则恕我直言,这通常比值得付出更多的努力。

关于in-app-purchase - 在应用购买成功后存储购买数据(osx 应用商店应用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17114610/

相关文章:

xcode - Mac App Store 拒绝 - 应用沙箱未启用

macos - 非 MAS 应用程序 : Implement license validation, 还是没有?

ios - itms-services//action=purchaseIntent 未打开应用

android - 用户不符合此次购买的条件 Android inApp

iphone - 我可以在 iPhone/iPad 应用程序中使用 PayPal 吗?

objective-c - 非 Cocoa 命令行应用程序是否与 Mac App Store 兼容?

macos - 在 Mac App Store 之外分发应用程序

android - 使用 Purchase Status API 验证 Google Play 收据,但总是收到 403 forbidden

android - 如果我的应用程序只需要一次购买项目,我是否需要使用消费一次购买?

xcode - 如何使用 xcode 3.2.5 将应用程序提交到 mac 应用程序商店