Question

Expo and Storekit

  • 17 September 2023
  • 4 replies
  • 658 views

Badge +2

I didn’t understand how to test the inApp purchases on a iOS simulator using Expo.

 

I usually run my code with

npx expo run:ios    

 

I’ve created the subscription and certificate in XCode following the documentation: https://www.revenuecat.com/docs/apple-app-store#ios-14-only-testing-on-the-simulator

 

Now I’m not sure how to build/run correctly the app.

 

 


4 replies

Userlevel 4
Badge +6

Hey @wullig ,

 

We have a pretty useful tutorial on how to test with Expo that can be found on the blog post here. I have gone ahead and copied the testing section of the guide which can be found below:

Now that Expo has built our native apps for us, we can begin testing our React Native app and RevenueCat integration. We’ll do this by running a local development server that our native apps can connect to. That command is:

expo start --dev-client

When you open either the Android or iOS app, you’ll be presented with a screen to connect to the local development server. Your phone may find the local development server automatically, but it might not—I had to manually connect to mine by entering the local IP address of my computer.

Once you’re connected, it will load your React Native app. And if all goes well, RevenueCat will load your offerings and products!

If something goes wrong, there are some tools that you can use to debug. RevenueCat has debug logs that print to the console. If you are using an iOS device, you can use Console.app on your Mac to view these logs. If you are using an Android device, you can use LogCat (or Android Studio) to view these logs. The logs will show what products can or can’t be loaded, as well as any associated errors.

Hi Michael,

 

It looks like there’s could be an additional step to get purchases to work - your blog post just lists the offerings/packages. For instance, when the code snippet below is instantiated:
 

           try {
const {
customerInfo,
productIdentifier,
} = await Purchases.purchasePackage(packages[0]);
} catch (error) {
console.log("RC cannot purchase a package: ", error);
}

 

I am getting the generic error message of “Error: There was a problem with App Store error message.” I have logged in using multiple email addresses listing in the Sandbox Test Accounts page in Apple Connect. Based on the OPs post above, there are additional instructions on how to get purchases working in the Simulator, but those instructions looks to be specifically for Simulators run on XCode. 

Badge +5

@always-on-chain Hi, I have the same problem. The docs write about a local Storekit config in XCode. But is there a way to use a Expo plugin or something to add this config to the Expo build?

Badge +5

The docs describe that you should test this on a real device. On a Simulator it is not working….to bad. Would like to use the StoreKit.cfg locally with expo

Reply