Hi,
Whenever trying to call Product.products(for: list) where list contains ids of my subscriptions, I get the following error. I can't seem to catch this error regardless of how i try to implement do/catch, and it only happens on real IDS, if i use an ID that doesn't exist, then it just returns an empty list and doens't crash.
I haven't deployed my app yet, and it's my first app, so I'm not sure if it may be an issue with the subscriptions not being approved yet. I do have all of my agreements signed / bank accounts setup, so i'm not sure.
libswiftCore.dylib`swift_willThrow:
-> 0x1a10b9f58 <+0>: pacibsp
0x1a10b9f5c <+4>: str x19, [sp, #-0x20]!
....
@MainActor
class PurchaseManager: ObservableObject {
private let productIds = ["00"]
@Published
private(set) var products: [Product] = []
private var productsLoaded = false
func loadProducts() async throws {
guard !self.productsLoaded else { return }
self.products = try await Product.products(for: ["com.one_dollar"])
self.productsLoaded = true
print("Products")
print(self.products)
}
....
}
where i'm calling it:
struct AmountSelectionView: View {
@EnvironmentObject var purchaseManager: PurchaseManager // Add this line
var body: some View {
HStack(spacing: 16) {
...
}
.padding()
.padding(.top, -30)
.task {
Task {
print("Loading Products")
do {
try await purchaseManager.loadProducts()
} catch {
print("error")
print(error)
}
}
}
}
}