Post

Replies

Boosts

Views

Activity

SKTestSession: declined Ask to Buy now produces a purchased transaction on iOS 27.2. Expected?
Hello! I'm glad that Xcode 27.2 could fix many StoreKit testing issues (27.2 release notes). While refreshing my unit tests for Xcode 27.2, I noticed a new behavior of "Ask to Buy" transactions. Since Xcode/iOS 27.2 at least, it seems that declining an Ask to Buy request in an SKTestSession makes StoreKit 2 record a purchase. Is this the intended new behavior? To reproduce: let session = try SKTestSession(configurationFileNamed: "ConfigFile") session.askToBuyEnabled = true session.resetToDefaultState() session.disableDialogs = true session.clearTransactions() let result = try await product.purchase() // .pending let pending = session.allTransactions().first! // state .deferred try session.declineAskToBuyTransaction(identifier: pending.identifier) // a few seconds later for await t in Transaction.all { print(t.unsafePayloadValue) }In my case the purchased product is an auto-renewable subscription with a free-trial intro offer, from a local .storekit file, in a unit test run inside a host app. After the decline, I could observe the following iOS 26.2 simulator SKTestTransaction.state = .deferred Transaction.updates : nothing Transaction.all : empty iOS 27.2 simulator SKTestTransaction.state = .failed Transaction.updates : emits a transaction Transaction.all : 1 transaction: ownershipType = .purchased, reason = .purchase, no revocation, expires at the end of the trial. The test session marks the request as failed, yet StoreKit 2 reports an active subscription... My understanding was that a declined "Ask to Buy" request never produces a transaction. With the new behavior, apps relying on Transaction.all or currentEntitlements would grant access that the Apple user refused... Is the new behavior expected? Or is it a regression (and is it limited to SKTestSession) ? Thanks for your help!
0
0
77
2w
Apple Sign-In: transfer an app twice in a row
When transferring an app from one team to another, Sign in with Apple users have to me carefuly migrated since their unique identifiers are team-scoped. To migrate users from Team A to Team B, a transient transfer identifier, aka transfer_sub, has to be generated by Team A before the transfer to prepare the app data, using specific migration endpoints provided by Apple. "Preparing the app data" means, for example, associate database entries to the transfer id instead of the team-specific id. One the app has been transferred, and during 60 days, Team B will find the transfer_sub in ID tokens issued by Apple Sign In, and thanks to this shared identifier they can retrieve the user data and associate it to their new unique identifier. So far so good ! Now, the question : if an app is transferred from Team A to Team B, and then, shortly thereafter (a few days later), from team B to team C, will the transfer_sub related to the B-C transfer be different ? Or will they remain the same as the ones issued for the A-B transfer ? (I'm asking this question in order to avoid the possible catastrophe of an ill-prepared double app transfer) Thank you !
1
1
1.4k
Sep ’24
SKTestSession: declined Ask to Buy now produces a purchased transaction on iOS 27.2. Expected?
Hello! I'm glad that Xcode 27.2 could fix many StoreKit testing issues (27.2 release notes). While refreshing my unit tests for Xcode 27.2, I noticed a new behavior of "Ask to Buy" transactions. Since Xcode/iOS 27.2 at least, it seems that declining an Ask to Buy request in an SKTestSession makes StoreKit 2 record a purchase. Is this the intended new behavior? To reproduce: let session = try SKTestSession(configurationFileNamed: "ConfigFile") session.askToBuyEnabled = true session.resetToDefaultState() session.disableDialogs = true session.clearTransactions() let result = try await product.purchase() // .pending let pending = session.allTransactions().first! // state .deferred try session.declineAskToBuyTransaction(identifier: pending.identifier) // a few seconds later for await t in Transaction.all { print(t.unsafePayloadValue) }In my case the purchased product is an auto-renewable subscription with a free-trial intro offer, from a local .storekit file, in a unit test run inside a host app. After the decline, I could observe the following iOS 26.2 simulator SKTestTransaction.state = .deferred Transaction.updates : nothing Transaction.all : empty iOS 27.2 simulator SKTestTransaction.state = .failed Transaction.updates : emits a transaction Transaction.all : 1 transaction: ownershipType = .purchased, reason = .purchase, no revocation, expires at the end of the trial. The test session marks the request as failed, yet StoreKit 2 reports an active subscription... My understanding was that a declined "Ask to Buy" request never produces a transaction. With the new behavior, apps relying on Transaction.all or currentEntitlements would grant access that the Apple user refused... Is the new behavior expected? Or is it a regression (and is it limited to SKTestSession) ? Thanks for your help!
Replies
0
Boosts
0
Views
77
Activity
2w
Apple Sign-In: transfer an app twice in a row
When transferring an app from one team to another, Sign in with Apple users have to me carefuly migrated since their unique identifiers are team-scoped. To migrate users from Team A to Team B, a transient transfer identifier, aka transfer_sub, has to be generated by Team A before the transfer to prepare the app data, using specific migration endpoints provided by Apple. "Preparing the app data" means, for example, associate database entries to the transfer id instead of the team-specific id. One the app has been transferred, and during 60 days, Team B will find the transfer_sub in ID tokens issued by Apple Sign In, and thanks to this shared identifier they can retrieve the user data and associate it to their new unique identifier. So far so good ! Now, the question : if an app is transferred from Team A to Team B, and then, shortly thereafter (a few days later), from team B to team C, will the transfer_sub related to the B-C transfer be different ? Or will they remain the same as the ones issued for the A-B transfer ? (I'm asking this question in order to avoid the possible catastrophe of an ill-prepared double app transfer) Thank you !
Replies
1
Boosts
1
Views
1.4k
Activity
Sep ’24