Below, I have a button designed to facilitate the purchase of a subscription, which depends on the availability of the subscription in App Store Connect. This button is visible when testing locally using a StoreKit Configuration File synced from App Store Connect, and I have linked my subscription to my app in the information section. Currently, my app is in a "waiting for review" status, and the subscription is marked as "developer action needed - rejected." However, this issue of the button not appearing persisted even when the subscription was previously in the "waiting for review" status, indicating that the problem may not be related to the subscription status.
I'm encountering an issue where the 'request products' function returns no results in the TestFlight environment, even when using a sandbox Apple ID. This problem has led to repeated rejections of my app, as testers are unable to verify its functionality. What could be causing these issues?
VStack {
if storeVM.subscriptions.isEmpty {
if storeVM.isLoading {
ProgressView("Loading subscriptions...")
.progressViewStyle(.circular)
.scaleEffect(2.0)
.padding()
} else if let errorMessage = storeVM.errorMessage {
Text("Error: \(errorMessage)")
.foregroundColor(.red)
.padding()
} else {
Text("No subscriptions available")
.padding()
}
} else {
ForEach(storeVM.subscriptions, id: \.id) { product in
Button(action: {
Task {
await buy(product: product)
}
}) {
HStack {
Spacer()
Text("Unlock 3-day free trial. \nThen $23.99 per year. Cancel anytime.")
.font(.custom("Lora-VariableFont_wght", size: 20))
.foregroundColor(.white)
.lineSpacing(5)
Spacer()
}
}
.padding()
.background(Color.black.opacity(0.6))
.cornerRadius(10)
.padding(.horizontal, 10)
}
}
.onAppear {
Task {
await storeVM.requestProducts()
}
}
func requestProducts() async {
isLoading = true
errorMessage = nil
do {
subscriptions = try await Product.products(for: productIds)
isLoading = false
} catch {
print("Failed product request from App Store server: \(error)")
isLoading = false
errorMessage = "Failed to load products"
}
}