Skip to main content
Question

Revenuecat API fetches data in local development builds (and Expo Go) but does not fetch any data with Test Flight


Forum|alt.badge.img+2

I build local development builds and the Revenuecat API works fine. Even with Expo Go, Revenuecat works fine, but it does not load data from Revenuecat when submitted to Test Flight and installed on my iPhone. Basically my offers are not shown at all. 

 

Here is the data loading component: 

const SubscribePackages = () => {

  const [packages, setPackages] = useState([]);
  const navigation = useNavigation();

  const fetch_prices = async() => {
    const result = await Purchases.getOfferings()
    setPackages(result.current.availablePackages)
  }

  const subscribe = async(item) => {
    try {
      const {purchaserInfo} = await Purchases.purchasePackage(item)
      const purchase = await Purchases.getCustomerInfo()
      console.log('purchase: ', purchase)
      if(typeof purchase.entitlements.active['pro'] !== 'undefined') {
        await navigation.navigate('Account')
      }
    } catch (error) {
      console.log(error)
    }
  }

  useEffect(() => {
    fetch_prices()
  }, [])

  return (
    <View>
      {packages.length > 0 ? packages.map((item) => {
        return <View key={item.identifier}>
                  <ProductCard 
                      name={item.packageType} 
                      price={item.product.priceString}
                      currency={item.product.currencyCode}
                      subscribe={() => subscribe(item)} 
                  />
              </View>
      }) : <Text className="p-2 flex text-center font-bold text-gray-700">Data not loaded</Text>}
    </View>
  )
}

export default SubscribePackages



 

2 replies

Ryan Glanz
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 369 replies
  • November 1, 2023

Hi,

Happy to help here. Can you send full debug logs? They can be enabled like this.


Forum|alt.badge.img+2

Hi @ryan I’m new to mobile development. The mistake was I thought the environment variables would be exported into the Test Flight environment. I mean the keys inside `.env` file, but they were not exported at all. That caused a lot of confusion for me. I fixed it simply by exposing the public keys where the calls were made as I have no better solution for now. But I’ll check how to fix that.

Best. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings