Description:
In iOS 17, there is a bug where the Product.products() method from StoreKit returns an empty array on the first launch of the app after installation. However, subsequent launches of the app do not have this issue, and the product array is populated correctly. This problem can be reproduced by deleting and reinstalling the app. It should be noted that this bug is specific to iOS 17, as iOS 16 and iOS 15 do not exhibit the same behavior.
Reproduction Steps:
Install the app on an iOS 17 device.
Launch the app for the first time.
Notice that the product array is empty.
Close the app.
Reopen the app.
Verify that the product array is no longer empty.
import SwiftUI
import StoreKit
struct ContentView: View {
var body: some View {
VStack {
Text("Products are empty on initial app launch in iOS 17")
}.task {
let products = try? await Product.products(for: ["premium"])
print(products)
}
.padding()
}
}