提供商品

商品Product ID形式
広告除去com.happyboy1002.BlockPuzzle.removeAds非消耗型・買い切り

StoreManager API

@Observable @MainActor
final class StoreManager {
    var products: [Product]
    var purchasedProductIDs: Set<String>
    var isAdFree: Bool { purchasedProductIDs.contains("com.happyboy1002.BlockPuzzle.removeAds") }

    func loadProducts() async
    func purchase(_ product: Product) async throws
    func restorePurchases() async throws
    func listenForTransactions()
    func updatePurchasedProducts() async
}

処理フロー

  1. App起動時に listenForTransactions() + updatePurchasedProducts() + loadProducts()
  2. 購入時 product.purchase()
  3. VerificationResult で不正チェック
  4. 成功で purchasedProductIDs に追加 + transaction.finish()
  5. Transaction.updates で自動同期

ビジネスルール

変更履歴

バージョン日付変更内容
1.02026-05-09初版作成