Using a modified version of the following example
var body: some View {
NavigationSplitView {
BackyardList(isSubscribed: isSubscribed, backyardLimit: passStatus.backyardLimit, onOfferSelection: showSubscriptionStore)
.navigationTitle("Backyard Birds")
.navigationDestination(for: Backyard.ID.self) { backyardID in
if let backyard = backyards.first(where: { $0.id == backyardID }) {
BackyardTabView(backyard: backyard)
}
}
} detail: {
ContentUnavailableView("Select a Backyard", systemImage: "bird", description: Text("Pick something from the list."))
}
.sheet(isPresented: $showingSubscriptionStore) {
SubscriptionStoreView(groupID: groupID)
}
.onInAppPurchaseCompletion { _, purchaseResult in
guard case .success(let verificationResult) = purchaseResult,
case .success(_) = verificationResult else {
return
}
showingSubscriptionStore = false
}
}
(from Apple's sample code demonstrating in-app purchases), I'm unable to complete a sandbox purchase on Apple Watch. I get the error in the UI
Unable to Purchase App
Sign in with your Apple ID from the Apple Watch app on your iPhone
and printing purchaseResult
outputs failure(StoreKit.StoreKitError.unknown)
. An Apple ID is signed into Settings on iOS, as well as the Apple Watch app. This occurs whether or not a separate sandbox Apple ID is signed into Settings under App Store. The subscription options UI appears as expected before attempting to purchase one.