dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.74k stars 630 forks source link

E_IAP_NOT_AVAILABLE #2441

Open brenopenia1 opened 1 year ago

brenopenia1 commented 1 year ago

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description

Hello, I'm trying to run initConnection() and I get this error: E_IAP_NOT_AVAILABLE

versions "react-native": "0.71.8", "react-native-iap": "^12.10.5",

Environment:

brenopenia1 commented 1 year ago

I tried to run this im my code:

const checkConnectionStatus = async () => {

    try {
        const isConnected = await RNIap.initConnection();
        console.log('App Store connection status:', isConnected);
        // isConnected will be true if the connection is successful
      } catch (error) {
        console.log('Error checking App Store connection:', error);
      }

  };

  and the error E_IAP_NOT_AVAILABLE appears can someone help me?
musawarbilal786 commented 1 year ago

Use "connected" instead of your whole code, I hope it will fix your problem

Here is example:- import { useIAP } from "react-native-iap"

const { connected, products, getProducts, finishTransaction, currentPurchase, currentPurchaseError, } = useIAP()

if (!connected) { setConnectionErrorMsg("Please check your internet connection") }

ali03111 commented 3 months ago

this solution is not working even i put the code in to the connected condition but the app is crash after buy the subscription from the android app