이 페이지에서

인앱 구매 데모 - 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.