Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Requesting an In App Purchase in iOS 13 fails

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?

like image 622
Timothy C. Avatar asked Sep 20 '19 00:09

Timothy C.


People also ask

Why can't I make an in-app purchase on my iPhone?

Make sure you're signed in with the same Apple ID that you used to make the purchase. Make sure in-app purchases are allowed on your device. Restart your device: Restart your iPhone.

Why does my in-app purchase keep failing?

Expired credit cards or old billing addresses are a common reason for payments not to work properly. - Try a different payment method. If you're trying to make an in-app purchase but the transaction is declined or the payment won't go through, try to change your payment method.


3 Answers

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

like image 93
silvansky Avatar answered Nov 02 '22 06:11

silvansky


I had the same issue, iOS13 Simulators produced the same error, iOS12 Simulators were working well. I then tried out on the iPhone with iOS13 installed, there the calls were working flawlessly too.

Hoping that it'll be fixed soon in Xcode Simulators, I guess until then we are stuck with the error.

Edit: Now it seems to work also in iOS 13 Simulator Devices.

like image 27
Maverick2805 Avatar answered Nov 02 '22 05:11

Maverick2805


Note: I've updated the answer, read the Edit part.

To share my experience, it seems that this problem does not exist any more in Xcode 11.1 GM Seed. There's no need to restart Simulators or Xcode to make in-app purchases work anymore.

I had submitted an app for review and it was rejected because of that particular error. As it turns out, it was rejected for a stupid reason as it wasn't my app's bug, however I spent hours trying to get around it.

So, just update to Xcode 11.1 GM Seed and run again. Everything will be okay.

EDIT

The issue still exists in Xcode 11.1 and apparently I was just lucky that it didn't happen to me again. However, I had a second rejection for the exact same reason. What eventually worked and made my app get approved was this:

I had to update my IAP record on App Store by editing and saving it again.

So, I recommend you to try the same; change something temporarily in your IAPs, save and then revert your changes (and save again) so records on the App Store to be refreshed.

FYI, after the second rejection Apple invalidated my IAP and therefore showed me the way. It looks like to be a known issue to them at the end.

For details read this discussion I wrote on Reddit.

like image 37
Gabb Avatar answered Nov 02 '22 05:11

Gabb