My in-app purchases do not work with the iPad but work pretty well via the iPhone. From the technology and logic part, it shouldn't be like that. I can not find any info connected to that issue. As I saw in the terminal, it returns an invalid product identifier if I run it on the iPad simulator. But with simulation on all iPhone models, everything runs well. It should not be like that because referencing the official documentation works the same on both systems.
Here is the fetching function:
public func fetchProducts(){
let request = SKProductsRequest(productIdentifiers: Set(Product.allCases.compactMap({ $0.rawValue })))
request.delegate = self
request.start()
}
I call it like that:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
IAPManager.shared.fetchProducts()
FirebaseApp.configure()
return true
}
And that function is a part of the Singleton class.
So when I tried to buy an Item I retrieved that in terminal, because the array of fetched products was empty. With iPhones, the function works correctly and fetches all the products.
2022-12-15 17:53:46.397764+0100 Quotely[63397:3419642] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 1 beyond bounds for empty NSArray'
I found the answer to my question, maybe someone else will come across a similar one. I just created a new StoreKit configuration file and everything started working fine with it.