1 Reply
      Latest reply on Oct 4, 2019 8:14 AM by eskimo
      haleydr82 Level 1 Level 1 (0 points)

        Hello all!

         

        In the latest released version of my app, I'm seeing an issue in production that does not appear when I run the app from XCode. This has to do with new In-app purchase functionality, and it seems like SKProductRequest is not returning any products.

         

        Is there any way to debug this issue in the production version? As soon as I launch it from XCode, everything works as expected.

         

        Thanks in advance!

        • Re: How to troubleshoot an issue that only appears in production?
          eskimo Apple Staff Apple Staff (12,015 points)

          It depends on what aspect of being in production in causing the problem:

          • Many problems that only show up in production are caused by difference between the Debug and Release builds (A).

          • In your situation, it’s possible that the in-app purchase APIs are behaving different in your product build (B).


          With regards A, you can debug your release build Xcode, although it’s a bit tricky.  The basic idea is as follows:

          1. In the Organizer, select the archive that you submitted to the store.

          2. Click Distribute App.

          3. In the sheet, select Development and click Next.

          4. Follow through that workflow, which results in Xcode exporting a .ipa.

          5. Using the Device and Simulators window, install the .ipa on your device.

          6. Run the app from the Home screen.

          7. Attach to it with Xcode (Debug > Attach to Process), and you’re up and debugging.

          You’ll see some strange behaviours from the debugger because you’re targeting an optimised build, but it may be enough to give you a critical hint.


          If this build of your app doesn’t reproduce the problem then you’re dealing with sitation B.  This is substantially trickier.  The only good option is:

          1. Use os_log to add logging to your app so that you can follow the in-app purchase process.

          2. Publish that build to TestFlight.

          3. Use the Console app on macOS to monitor your logging.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"