Requesting an In App Purchase in iOS 13 fails

Timothy C. picture Timothy C. · Sep 20, 2019 · Viewed 7.7k times · Source

I use SwiftyStoreKit to request In App Purchases and get only this error with iOS 13:

Error: Optional(Error Domain=ASDErrorDomain Code=507 "Error decoding object" UserInfo={NSLocalizedDescription=Error decoding object, NSLocalizedFailureReason=Attempted to decode store response})

I cannot request information about the products, nor make purchases with a sand box account. However, it works fine in iOS 12.1 on my device. It does not work with the iPhone 11 simulator or an actual device with iOS 13.

I have found a lot, that the Xcode 11 GM seed 1 beta simulator had this problem, but have not found a solution yet. I also tested it with the new released Xcode 11 GM seed 2 version, but there was no fix for me.

Does anyone have a solution on how I can request and purchase In App Purchases again with iOS 13 installed?

Answer

silvansky picture silvansky · Sep 23, 2019

Restarting Xcode and simulator did the trick: now my in-app purchases load properly in iOS 13 simulator.

EDIT: This happens in release Xcode 11 too. And happens once in a while, but restarting Xcode and simulators still helps.

EDIT 2: In Xcode 12 beta this bug is also present. But the solution is to create new StoreKit Configuration file (in File -> New menu)

Adding StoreKit Configuration file

Then add all your products there. Use the same product id's as in AppStore Connect.

Adding products

Then add this file to Run Scheme configuration.

Setting Scheme Run options