I'm quite excited about the newly announced bundle and suite feature and trying to test the new Subscription Bundle type introduced in the recent Xcode Beta (using a local .storekit configuration file).
I have set up:
- A local .storekit file.
- Inside it, I configured a Subscription Bundle with the ID "bundle".
- This bundle is linked to two internal auto-renewable subscriptions in the same file.
- The StoreKit configuration is active in my Scheme options.
When I try to fetch a standard auto-renewable subscription ID, it works perfectly. However, when I try to fetch the "bundle" ID, the API returns successfully but with an empty array [] (no errors thrown).
Is there a different way to query/fetch the new Subscription Bundle type in StoreKit 2, or is local testing for bundles not yet supported in the simulator in this beta?
My sample code
import StoreKit
@MainActor
class StoreManager: ObservableObject {
@Published var products: [Product] = []
func fetchProducts() async {
do {
// "bundle" is defined in our local .storekit file as a SubscriptionBundle
self.products = try await Product.products(for: ["bundle"])
print("Fetched products: \(self.products.map { $0.id })")
} catch {
print("Fetch error: \(error)")
}
}
}
struct ContentView: View {
@StateObject private var store = StoreManager()
var body: some View {
VStack {
if store.products.isEmpty {
Text("Stuck Loading: Product not found.")
} else {
ForEach(store.products, id: \.id) { product in
Text("Found: \(product.displayName) - \(product.displayPrice)")
}
}
}
.task {
await store.task {
await store.fetchProducts()
}
}
}
}
My storekit
"appPolicies" : {
"eula" : "",
"policies" : [
{
"locale" : "en_US",
"policyText" : "",
"policyURL" : ""
}
]
},
"identifier" : "2B237494",
"nonRenewingSubscriptions" : [
],
"products" : [
],
"settings" : {
"_askToBuyEnabled" : false,
"_billingGracePeriodEnabled" : false,
"_billingIssuesEnabled" : false,
"_disableDialogs" : false,
"_failTransactionsEnabled" : false,
"_locale" : "en_US",
"_renewalBillingIssuesEnabled" : false,
"_storefront" : "USA",
"_storeKitErrors" : [
],
"_timeRate" : 0
},
"subscriptionBundleGroups" : [
{
"id" : "EE1EB207",
"localizations" : [
],
"name" : "bundle_group",
"subscriptions" : [
{
"displayPrice" : "0.99",
"duration" : "P1M",
"groupNumber" : 1,
"internalID" : "84A95B47",
"introductoryOffers" : [
{
"billingPlanType" : "BILLED_UPFRONT",
"internalID" : "DD9208A6",
"numberOfPeriods" : 1,
"paymentMode" : "free",
"subscriptionPeriod" : "P1W"
}
],
"isFamilyShareable" : false,
"linkedSubscriptions" : [
{
"internal" : "D1A384C1"
},
{
"internal" : "01ABB5D2"
}
],
"localizations" : [
{
"description" : "",
"displayName" : "",
"locale" : "en_US"
}
],
"productID" : "bundle",
"referenceName" : "Awesome Bundle",
"subscriptionGroupID" : "EE1EB207",
"type" : "SubscriptionBundle"
}
]
}
],
"subscriptionGroups" : [
{
"id" : "84E94B59",
"localizations" : [
],
"name" : "premium_group",
"subscriptions" : [
{
"adHocOffers" : [
],
"billingPlans" : [
{
"billingPlanType" : "BILLED_UPFRONT",
"commitmentDisplayPrice" : "1.99",
"displayPrice" : "1.99",
"internalID" : "21C9C75B",
"isEnabled" : true
}
],
"codeOffers" : [
],
"displayPrice" : "1.99",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "D1A384C1",
"introductoryOffer" : {
"billingPlanType" : "BILLED_UPFRONT",
"displayPrice" : "0.99",
"internalID" : "F0651A66",
"numberOfPeriods" : 1,
"paymentMode" : "payUpFront",
"subscriptionPeriod" : "P1M"
},
"introductoryOffers" : [
{
"billingPlanType" : "BILLED_UPFRONT",
"displayPrice" : "0.99",
"internalID" : "F0651A66",
"numberOfPeriods" : 1,
"paymentMode" : "payUpFront",
"subscriptionPeriod" : "P1M"
}
],
"localizations" : [
{
"description" : "",
"displayName" : "",
"locale" : "en_US"
}
],
"productID" : "premium_monthly",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "premiume monthly",
"subscriptionGroupID" : "84E94B59",
"type" : "RecurringSubscription",
"winbackOffers" : [
]
}
]
},
{
"id" : "39607B86",
"localizations" : [
],
"name" : "basic_group",
"subscriptions" : [
{
"adHocOffers" : [
],
"billingPlans" : [
{
"billingPlanType" : "BILLED_UPFRONT",
"commitmentDisplayPrice" : "0.99",
"displayPrice" : "0.99",
"internalID" : "0FAC3C7D",
"isEnabled" : true
}
],
"codeOffers" : [
],
"displayPrice" : "0.99",
"familyShareable" : false,
"groupNumber" : 1,
"internalID" : "01ABB5D2",
"introductoryOffers" : [
],
"localizations" : [
{
"description" : "",
"displayName" : "",
"locale" : "en_US"
}
],
"productID" : "basic_monthly",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "basic monthly",
"subscriptionGroupID" : "39607B86",
"type" : "RecurringSubscription",
"winbackOffers" : [
]
}
]
}
],
"subscriptionSuiteGroups" : [
],
"version" : {
"major" : 6,
"minor" : 3
}
}