Post

Replies

Boosts

Views

Activity

Reply to Storekit 2 some question
All Question is on IAP Sandbox Test Question one: unfinished transation never Automatic trigger ,such as when I start up again,i can not fetch the unfinished transations in the Transaction.updates?   /// - Returns: Task   func listenForTransactions() -> Task<Void, Error> {     return Task.detached {       //Iterate through any transactions which didn't come from a direct call to `purchase()`.       for await result in Transaction.updates {         do {           let transaction = try self.checkVerified(result)           //Deliver content to the user.           await self.updatePurchasedIdentifiers(transaction)           //Always finish a transaction.           await transaction.finish()         } catch {           //StoreKit has a receipt it can read but it failed verification. Don't deliver content to the user.           print("AAAA=Transaction failed verification")         }       }     }   } Question Two: i call transaction.finish() after purchae success,but, when i user Transaction.unfinished to fetch all unfinished transations, the transaction still exist. the count of unfinished is growing   func restore() async {     try? await AppStore.sync()           await self.restoreProducts()   }       func restoreProducts() async {     var count:Int = 0     for await result in Transaction.unfinished {       //Don't operate on this transaction if it's not verified.       if case .verified(let transaction) = result {         //Check the `productType` of the transaction and get the corresponding product from the store.         switch transaction.productType {         case .nonConsumable:break         case .autoRenewable:           count += 1         case .nonRenewable:break         default:           //This type of product isn't displayed in this view.           break         }       }     }           print("unfinished = \(count)")   } Question There:how can i verified jws myself, not call the autoVafified api you provide, can you has some demo? thanks
Oct ’21