While testing some Storekit code in sandbox mode, I came across this problem:
public func Restore(){
Task{
do{
try await AppStore.sync()
// check entitlements etc....
}
catch {
switch error {
case StoreKitError.networkError(let network_error):
print("AppStore.sync => network error")
case StoreKitError.systemError(let sys_error):
print("AppStore.sync => system error")
case StoreKitError.userCancelled:
print("AppStore.sync => user canceled error")
case StoreKitError.notEntitled:
print("AppStore.sync => notEntitled error")
case StoreKitError.unknown:
print("AppStore.sync => unknown error")
}
}
}
when I deliberately shut down the wifi connection, I receive an userCanceled error instead of the expected network error.
I have only tested this in sandbox mode, not in production.
Running Ventura 13.2.1, latest version of Xcode & testing on iPad Air 4th generation iPadOS 16.3.1, minimum deployment target 15.0.
Anyone else ? solutions ? sandbox only issue ?
cheers
Post
Replies
Boosts
Views
Activity
Hi,
I am testing an implementation of a non renewing subscription.
State:
A user has an existing entitlement, and moves to a new device on which the user is not logged into the App Store.
Problem:
User not logged in -> currentEntitlements not available.
User, in error, presses purchase instead of restore (user is informed with small note.)
StoreKit 2 will warn the user that he has already purchased this in the past and will allow the user to buy again. (App Store Connect does not store non renewing subscription duration, so I can understand store kit behaviour)
Question:
Can I check if user is not signed into the App Store? then force a call sync prior to purchase.
OR
Should I just leave this tiny fringe case to Apple support to issue refunds for user error (dual subscriptions)?