4.4.8
0.61.5
iOS
await RNIap.requestPurchase(sku, false)
console.log('REQUEST OVER')
REQUEST OVER to be printed.
In device i use sandbox tester account, it is responding and working well. But with any other devices or simulator it is not responding or resolving. This is vital since during app review, Apple keep rejecting my application with reason of tapping in BUY is not responding.
There is no problem about RNIap.getProducts(itemSkus)
Real Device and Simulator
async componentDidMount() {
RNIap.getProducts(itemSkus)
.then((products) => {
this.setState({ products: products })
})
.catch((error) => {
console.log(error.message)
})
}
requestPurchase = async (sku) => {
try {
await RNIap.requestPurchase(sku, false)
console.log('REQUESTED OVER')
} catch (err) {
console.warn(err.code, err.message)
}
}
render() {
const { products } = this.state
return (
<View>
{products.map((p, i) => { return (
<TouchableWithoutFeedback onPress={() => this.requestPurchase(p.productId)}>
<Text> BUY </Text>
</TouchableWithoutFeedback> ) })}
</View>)
Same here, however it seems to work on Android.
I may have fixed it by adding
const result = await RNIap.initConnection();
await RNIap.consumeAllItemsAndroid();
console.log('result', result);
At the begining of componentDidMount ;
Let me know if that help
@hyochan Have you found a resolution to this? I am also experiencing the same problem in iOS. Its extremely frustrating, and I can't get past app review because calling RNIap.requestPurchase doesn't respond with the alert either promoting the user to agree to the subscription terms or confirming that the subscription is already active. If I force close the app and try it again, sometimes it works. I don't know if there is a problem with the sandbox or this library.
@smarttouchtechnology Have you called initConnection
? This is needed from 4.4.5
.
It may be hard for @smarttouchtechnology to read the answer below that "solve" the "problem" ;)
I had the same problem and @Panda313 suggestion to add await RNIap.initConnection()
in componentDidMount
worked.
Too bad this is not better documented...
@Panda313 ... You just saved me1 week sleepless night of apple rejection
Could someone add this to the documentation so more people don't run into this issue? I'm not sure the best way to add it.
EDIT: Added here. #1088.
Feel free to review (I'm not confident I did it right.)
I may have fixed it by adding
const result = await RNIap.initConnection();
await RNIap.consumeAllItemsAndroid();
console.log('result', result);At the begining of componentDidMount ;
Let me know if that help
For iOS, I didn't have any response from requestSubscription
. I tried adding await RNIap.initConnection();
in front of RNIap.requestSubscription
and it worked for me. Now I am receiving purchase objects in listeners in the root of the app. And it also proceeds further down the code after it resolves either in error or in successful response.
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
Most helpful comment
I had the same problem and @Panda313 suggestion to add
await RNIap.initConnection()
incomponentDidMount
worked.Too bad this is not better documented...