Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Test IAP in simulator - react-native?

$
0
0

I use react-native-iap, And I have Non-Consumable so I use getAvailablePurchases() but in every time I get this error

Cannot connect to iTunes Store

So I can't test what I do while developing or if the user buying successfully or not or what the result of data should return when using getAvilablePurchases() or other methods

So is there a way to solve this issue?

app store

Screen

Code

const items = Platform.select({     ios:"com.myapp.premium"  });export default class PurchaseScreen extends Component {  componentDidMount() {    this.getPurchases();  }  getPurchases = async () => {    try {      const init = await RNIap.initConnection();      console.log('init?', init);      const availablePurchases = await RNIap.getAvailablePurchases(items);      console.log('availablePurchases', availablePurchases);    } catch (err) {      console.warn(err);    }  };subscribe = ()=>{    ...}  render() {    return (<TouchableOpacity onPress={()=>this.subscribe()} style={styles.btn}><Text style={styles.lable}>Subscrib</Text></TouchableOpacity>   )  }}

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>