提供商品
| 商品 | 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
}
処理フロー
- App起動時に
listenForTransactions() + updatePurchasedProducts() + loadProducts()
- 購入時
product.purchase()
- VerificationResult で不正チェック
- 成功で purchasedProductIDs に追加 + transaction.finish()
- Transaction.updates で自動同期
ビジネスルール
- isAdFree=true で AdManager の広告表示を全停止
- 復元はいつでも可(restore = AppStore.sync())
- Family Sharing 対応
変更履歴
| バージョン | 日付 | 変更内容 |
|---|
| 1.0 | 2026-05-09 | 初版作成 |