StoreKit fetching product using local config file returns empty array on Mac

I am testing an in-app purchase in my app. The app has a multiplatform target with Mac (native, not Catalyst) and iPad destinations. I created a local StoreKit configuration file in Xcode and added an IAP to it. I edited the Xcode scheme to use my local config file. I have the following code to fetch the IAP:

@Published private(set) var products: [Product]

@MainActor
func fetchProducts() async {
	let productIdentifiers = ["com.pro_version"]
  	do {
    	products = try await Product.products(for: productIdentifiers)
  	} catch {
  		print("Failed product request from the App Store server: \(error)")
   	}
}

When I call this function, the products array is always empty on Mac but is not empty on iOS.

I checked that the product ID for the product in the config file matches the value of the productIdentifiers constant in the code.

What am I missing that is preventing me from fetching the products from my local StoreKit config file on Mac?

Answered by szymczyk in 771272022

What am I missing that is preventing me from fetching the products from my local StoreKit config file on Mac?

I was missing a Mac build in TestFlight. Once I added a mac build in TestFlight and got the build approved for external testing, I was able to fetch the products on Mac.

Accepted Answer

What am I missing that is preventing me from fetching the products from my local StoreKit config file on Mac?

I was missing a Mac build in TestFlight. Once I added a mac build in TestFlight and got the build approved for external testing, I was able to fetch the products on Mac.

StoreKit fetching product using local config file returns empty array on Mac
 
 
Q