after invoke "clearTransactionIOS" then app crash said "Cannot finish a purchasing transaction"
Please use the Discussion board if you want to get some help. Please use issues to report bugs.
Description
after invoke "clearTransactionIOS" then app crash said "Cannot finish a purchasing transaction" see attaachment
Expected Behavior
Screenshots
Environment:
- react-native-iap: 8.0.8
- react-native:0.86
- Platforms (iOS, Android, emulator, simulator, device): ios
To Reproduce Steps to reproduce the behavior:
code invoked
await iap.clearTransactionIOS(); await purchaseSubscription(subId).catch((error) => { if (error && error.code !== 'E_USER_CANCELLED') { SubscriptionActions.log({ source: 'purchaseProduct:purchase_error', error, subId }); console.warn('subscribe error', subId, error); } });
and see some crashes on firebase
[Optional] Additional Context
@andresesfm Did you ever find a solution? I am experiencing this issue.
My understanding was that clearTransactionIOS was supposed to be used in debug only. Do you have more information?
@andresesfm That makes sense. The reason I tried calling it is because calling requestPurchase is not doing anything for me on iOS. I was thinking maybe I had to clear pending transactions?. Maybe you can help? Code is below. :')
App.js
import { initConnection } from 'react-native-iap';
useEffect(() => {
initIAP()
}, [])
async function initIAP () {
await initConnection()
}
PurchaseScreen.js
const items = Platform.select({
default: ['quick_boost_ios'],
});
useEffect(() => {
setupIAP()
}, [])
const setupIAP = async () => {
getProducts({ skus: items }).then(async (res) => {
setProducts(res)
})
}
purchase = async (sku) => {
try {
await requestPurchase({
sku,
andDangerouslyFinishTransactionAutomaticallyIOS: false,
});
console.log('REQUESTED OVER')
} catch (err) {
console.warn(err.code, err.message)
}
};
return (
products.map((prod, key) => {
return (
<TouchableOpacity onPress={() => this.purchase(prod.productId)}>
<Text>Buy Me</Text>
</TouchableOpacity>
)
})
)
Hey. I have the same issue. Have you fixed it?
Also same issue here. Some extra debug information:
Iām closing all issues reported in versions below 14, as the library now supports the new architecture with NitroModules and has been completely revamped.