58

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?

8
  • Could you please provide the code of how you make purchases? I use Xcode 11 GM seed but didn't get any errors yet.
    – apphud
    Sep 20, 2019 at 5:22
  • I am seeing the same issues, but using RMStore, which although not maintained, still works fine up to iOS 12.
    – mstenroos
    Sep 20, 2019 at 17:03
  • Have any progress on this? I'm having a very similar issue. Sep 21, 2019 at 19:58
  • I've tried everything possible to make In App purchases work in the beta version of iOS 13, too. Also my app was rejected by Apple (No action when using the buy button) before the release of iOS 13. Later I was able to test the app with an iPhone 11 and the public version of iOS 13 and everything works fine again. I can't tell what it was all about. I didn't change the code either. The app is now "Waiting for review" again. I'll give you another update if it will be accepted. There are no more errors in the console launching the App with iPhone 11, iOS 13.
    – Timothy C.
    Sep 23, 2019 at 1:06
  • Having the same issue with Xcode 11 release. iOS 13 simulator doesn't load any products with same error message.
    – silvansky
    Sep 23, 2019 at 13:24

4 Answers 4

132

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

6
  • 3
    This also worked for me, on the release version of Xcode (and simulators). Before that point I encountered the same error in the iPad simulator, but not the iPhone simulator. Sep 23, 2019 at 22:50
  • 7
    Happens to me each time I start new simulator. Good job, Apple. :( Oct 10, 2019 at 14:07
  • 1
    I was going mad. (2) Restarting xCode and Simulator helps. Thanks a lot! Jun 17, 2020 at 15:33
  • Thanks for your solution with the StoreKit Configuration file. We have added this to Xcode 12.2, as the Simulator always responded with ASDErrorDomain code 507, despite serval restarts of Xcode and Simulator. NOTE: When using this scheme on a real device, it will no longer retrieve the IAPs from the App Store, but read from the StoreKit Configuration file. So we have duplicated the scheme, and use the one with the StoreKit Configuration file on the Simulator only.
    – Martijn
    Dec 4, 2020 at 8:02
  • 4
    If you're unfamiliar with Xcode (like I am): schemes can be edited by navigating to Product > Scheme > Edit Scheme. Mar 15, 2021 at 0:40
1

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.

1
  • It's still happening in simulators after you reset all content and settings. Xcode 11.2.1 (11B500)
    – Kukiwon
    Nov 27, 2019 at 12:16
1

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.

2
  • @TimurBernikovich Thanks for the update, I've been told the same by others too. I edited my answer and I describe how it finally worked for me.
    – Gabb
    Oct 12, 2019 at 7:18
  • I'm still having this issue in Xcode 11.2.1 (11B500)
    – Kukiwon
    Nov 27, 2019 at 8:50
1

For those that has this issue in iOS 14.0, you still need to create the storekit configuration file as per @silvansky answer. Rather than adding it to the target, we can actully start an SKTestSession before making any product request in order to avoid the error.

if #available(iOS 14.0, *) {
    do {
        let session = try SKTestSession(configurationFileNamed: "Your_StoreKit_Configuration_File_Name")
        session.disableDialogs = true
    } catch {
        // catch error here
    }

    // Start your product request here
    let productIdentifiers = Set(["product_identifier_1", "product_identifier_2"])
    let productsRequest = SKProductsRequest(productIdentifiers: productIdentifiers)
    productsRequest.delegate = self

    // Run the request
    productsRequest.start()
}

You can refer to Apple's documentation for SKTestSession for more info: https://developer.apple.com/documentation/storekittest/sktestsession

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.