鍍金池/ 教程/ iOS/ 準(zhǔn)備應(yīng)用程序?qū)彶?/span>
恢復(fù)購買記錄
內(nèi)置購買
介紹
準(zhǔn)備應(yīng)用程序?qū)彶?/span>
創(chuàng)建和配置產(chǎn)品
獲取產(chǎn)品信息
支付請求
使用訂閱
如何測試應(yīng)用程序內(nèi)置購買
產(chǎn)品交付

準(zhǔn)備應(yīng)用程序?qū)彶?/h1>

After you finish testing, you’re ready to submit your app for review. This chapter highlights a few tips to help you through the review process.

當(dāng)你完成測試以后,就表示已經(jīng)準(zhǔn)備好提交應(yīng)用以供審核。 該章節(jié)重點(diǎn)介紹了一些提示來幫助你通過審核過程。

Submitting Products for Review

一、遞交產(chǎn)品以供審核

The first time you submit your app for review, you also need to submit in-app products to be reviewed at the same time. After the first submission, you can submit updates to your app and products for review independently of each other. For more information, see In-App Purchase Configuration Guide for iTunes Connect.

當(dāng)你第一次提交審核程序時,你還需要同時提交內(nèi)置產(chǎn)品以供審核。 第一次遞交通過以后,以后更新應(yīng)用程序和產(chǎn)品時則可以分別提交。 更多信息,請看 In-App Purchase Configuration Guide for iTunes Connect.

Receipts in the Test Environment

二、在測試環(huán)境中的收據(jù)

Your app runs different environments while in development, review, and production, as show in Figure 7-1.

當(dāng)應(yīng)用程序在開發(fā),審核以及產(chǎn)品過程中,在不同的環(huán)境中運(yùn)行。如下圖:

Figure 7-1 Development, review, and production environments

http://wiki.jikexueyuan.com/project/in-app-purchase/images/11.png" alt="" />

During development, you run a development-signed version of your app, which connects to your development servers and the test environment for the App Store. In production, your users run a production-signed version of your app which connects to your production servers and the production App Store. However, during app review, your app runs in a mixed production/test environment: it’s production signed and connects to your production servers, but it connects to the test environment for the App Store.

在開發(fā)過程中,應(yīng)用程序的版本是一個開發(fā)簽名的版本,它連接到你的開發(fā)服務(wù)器以及應(yīng)用程序中的測試環(huán)境。 在產(chǎn)品過程中,你的用戶運(yùn)行一個產(chǎn)品簽名版本的應(yīng)用程序,它連接到你的產(chǎn)品服務(wù)器以及產(chǎn)品應(yīng)用商店。 然而,在應(yīng)用程序?qū)徍诉^程中,你的應(yīng)用程序運(yùn)行在一個混合的產(chǎn)品/測試環(huán)境中:它是產(chǎn)品簽名并且連接到你的產(chǎn)品服務(wù)器,但是它連接到應(yīng)用商店的測試環(huán)境中。

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. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code “Sandbox receipt used in production”, validate against the test environment instead.

當(dāng)你驗(yàn)證在服務(wù)器中的收據(jù)時,你的服務(wù)器需要能夠處理一個產(chǎn)品簽名的應(yīng)用程序,它從蘋果的測試環(huán)境中獲取它的收據(jù)。 推薦方法是總是首先為你的產(chǎn)品服務(wù)器激活收據(jù)而不是為產(chǎn)品應(yīng)用商店。 如果激活出現(xiàn) “Sandbox receipt used in production" 錯誤,則驗(yàn)證測試環(huán)境。

Implementation Checklist

三、實(shí)現(xiàn)核對清單

Before you submit your app for review, verify that you’ve implemented all of the required behavior. Make sure you’ve implemented the following core In-App Purchase behavior (listed in order of a typical development process):

在遞交你的審核應(yīng)用之前,驗(yàn)證你已經(jīng)實(shí)現(xiàn)了所有需要的行為。 確保你已經(jīng)實(shí)現(xiàn)了以下內(nèi)核內(nèi)置購買行為(以一個典型的開發(fā)過程順序列出):

Create and configure products in iTunes Connect.

在 iTunes Connect里創(chuàng)建并配置產(chǎn)品。

  • You can change your products throughout the process, but you need at least one product configured before you can test any code.

你可以在過程中更改產(chǎn)品,但是在測試任何代碼前,你至少需要一個已經(jīng)配置好的產(chǎn)品。

  • Get a list of product identifiers, either from the app bundle or your own server. Send that list to the App Store using an instance of SKProductsRequest.

從應(yīng)用束或服務(wù)器上獲取產(chǎn)品識別碼列表 (product identifiers). 用一個 SKProductsRequest 實(shí)例把列表發(fā)送給應(yīng)用商店。

  • Implement a user interface for your app’s store, using the instances of SKProduct returned by the App Store. Start with a simple inteface during development, such as a table view or a few buttons.

Implement a final user interface for your app’s store at whatever point makes sense in your development process.

使用應(yīng)用商店返回的 SKProduct ,為應(yīng)用商店實(shí)現(xiàn)一個用戶界面。開發(fā)過程中使用一個簡單的界面,比如一個表格視圖或一些按鈕。在開發(fā)過程中運(yùn)行順利后可以實(shí)現(xiàn)一個最終的用戶界面。

  • Request payment by adding an instance of SKPayment to the transaction queue using the addPayment: method of SKPaymentQueue.

使用 SKPaymentQueue的addPayment: 方法來添加一個 SKPayment 的實(shí)例到交易隊列,用來請求支付。

  • Implement a transaction queue observer, starting with the paymentQueue:updatedTransactions: method.

使用 paymentQueue:updateTransactions: 方法來實(shí)現(xiàn)一個交易隊列觀察者 (transaction queue observer)。

Implement the other methods in the SKPaymentTransactionObserver protocol at whatever point makes sense in your development process.

在你的開發(fā)過程中有任何需要時, 在 SKPaymentTransactionObserver 協(xié)議里實(shí)現(xiàn)其它方法。

  • Deliver the purchased product by making a persistent record of the purchase for future launches, downloading any associated content, and finally calling thefinishTransaction: method of SKPaymentQueue.

為了以后能夠啟動,做一個永久交易記錄,傳遞已被購買的產(chǎn)品,下載全部相關(guān)內(nèi)容,并在最后調(diào)用 SKPaymentQueue 的 finishTransaction:方法。

During development, you can implement a trivial version of this code at first—for example, simply displaying “Product Delivered” on the screen—and then implement the real version at whatever point makes sense in your development process.

在開發(fā)過程中,你可以只實(shí)現(xiàn)一個該代碼的簡易版本--比如,只是簡單的在屏幕上顯示“Product Delivered” 字樣---然后在開發(fā)過程中有任何需要時實(shí)現(xiàn)真實(shí)版本。

If your app sells non-consumable items, auto-renewable subscriptions, or non-renewing subscriptions, verify that you’ve implemented the following restoration logic:

如果你的應(yīng)用程序出售非耗材產(chǎn)品,自動更新訂閱,或者非自動更新訂閱,驗(yàn)證你已經(jīng)實(shí)現(xiàn)了以下恢復(fù)邏輯:

  • Provide UI to begin the restoration process.

提供 UI 來開啟恢復(fù)過程。

  • Retrieve information about past purchases by either refreshing the app receipt using the SKReceiptRefreshRequest class or restoring completed transactions using the restoreCompletedTransactions method of the SKPaymentQueue class.

通過使用 SKReceiptRefreshRequest 類來刷新應(yīng)用收據(jù)或者使用 SKPaymentQueue 類的 restoreCompletedTransactions 方法來恢復(fù)完整交易,來獲取過去購買的信息。

  • Let the user re-download content.

允許用戶重新下載內(nèi)容。

If you use Apple-hosted content, restore completed transactions and use the transaction’s downloads property to get an instance of SKDownload.

如果你使用了蘋果托管內(nèi)容,恢復(fù)完整交易并使用交易的downloads特性得到一個SKDownload類的實(shí)例。

  • If you host your own content, make the appropriate calls to your server.

如果你自己托管自己的內(nèi)容,正確訪問你的服務(wù)器。

If your app sells auto-renewable or non-renewing subscriptions, verify that you’ve implemented the following subscription logic:

如果你的應(yīng)用程序出售自動更新或非自動更新訂閱,驗(yàn)證你已經(jīng)實(shí)現(xiàn)了以下訂閱邏輯:

  • Handle a newly-purchased subscription by delivering the most recently published piece of content—for example, the latest issue of a magazine.

通過傳遞最新發(fā)布的內(nèi)容片斷來處理一個嶄新的購買訂閱---比如,一本雜志最新的問題。

  • When new content is published, make it available to the user.

當(dāng)新內(nèi)容發(fā)布時,用戶是可以使用的。

  • When a subscription expires, let the user renew it.

當(dāng)一個訂閱到期后,允許用戶重新更新它。

If your app sells auto-renewable subscriptions, let the App Store handle this process. Don’t try to handle it yourself.

如果你的應(yīng)用程序出售自動更新訂閱,允許應(yīng)用商店處理該過程。不要嘗試自己來處理。

If your app sells non-renewing subscriptions, your app is responsible for this process.

如果你的應(yīng)用程序出售非自動更新訂閱,你的應(yīng)用程序負(fù)責(zé)該過程。

  • When a subscription becomes inactive, stop making new content available. Update your interface so the user has the option to purchase the subscription again, re-activating it.

當(dāng)一個訂閱到期后,停止用戶使用新內(nèi)容。更新你的界面,這樣用戶就可以選擇再次購買該訂閱并重新激活它的內(nèi)容。

  • Implement some system to keep track of when content was published. Use this system when restoring purchases to give the user access to the content that was paid for, based on the periods of time the subscription was active.

實(shí)現(xiàn)一個系統(tǒng)來跟蹤最新發(fā)布的內(nèi)容。 當(dāng)恢復(fù)購買時,使用該系統(tǒng),讓用戶可以根據(jù)訂閱激活的時間來訪問他們已經(jīng)支付的內(nèi)容。

上一篇:產(chǎn)品交付下一篇:使用訂閱