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 getting this error

Cannot connect to iTunes Store

So i can't test what i do or if the user buying successfully or not!

So is there a way to solve this issue?

Code

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