このページでは

アプリ内課金デモ - iOSクラス

アプリ内課金デモには、以下のクラスが含まれています:

クラス

IosInAppPurchaseProductストアに登録された商品。
IosInAppPurchaseTransaction外部アプリストアにおけるトランザクションに関する情報を保持します。
IosInAppPurchaseBackend外部ストアと通信します。

アプリ内課金のデモをご覧ください。InAppProduct、InAppStore、InAppTransaction、InAppPurchaseBackend を含む基底クラスが用意されています。

IosInAppPurchaseProduct

IosInAppPurchaseProduct には、購入プロセスを初期化するための purchase() メソッドが追加されています。

IosInAppPurchaseTransaction

IosInAppPurchaseTransaction には、新しいパラメータと戻り値の型が追加されています。トランザクションのエラー処理は、IosInAppPurchaseTransaction のコンストラクタで実装されています。このクラスには、トランザクションを完了させる finalize() 関数が用意されています。

IosInAppPurchaseBackend

IosInAppPurchaseBackend は、Objective-C言語を使用して App Store と通信します。

商品の初期化

このクラスは、ストアページにプロダクトの情報を表示します。

  1. IosInAppPurchaseBackend は、InAppStore::setupBackend() から呼び出されます。
  2. 初期化時に、IosInAppPurchaseBackend は Objective-C を使用して InAppPurchaseManager を作成します。
  3. InAppStore::registerProduct(productType, &identifier) 関数が呼び出され、バックエンドで queryProduct() が実行されます。
  4. Objective-C の関数 requestProductData:() が呼び出され、SKProductRequest が行われます。
  5. SKProductRequest が完了し、Objective-C の productsRequest:( ) で製品オブジェクトが作成されると、IosInAppPurchaseBackend::registerProduct() 関数によって製品が登録されます。
  6. シグナル productQueryDone() が発信され、アイテムの情報がアプリケーションのストアページに表示されます。

購入プロセス

  1. ユーザーがアプリケーションのストアページでいずれかの商品をクリックします。
  2. IosInAppPurchaseProduct::purchase() 関数が呼び出され、IosInAppPurchaseBackend の Objective-C 関数 paymentQueue:( ) 内で、支払いがSKPaymentQueue に追加されます。
  3. ユーザー向けに購入確認のポップアップが表示されます。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.