hyochan / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.hyo.dev
MIT License
2.85k stars 647 forks source link

iOS 17 (and 16.6.1) Cannot read property 'transactionReceipt' of undefined #2546

Open dimaischenko opened 1 year ago

dimaischenko commented 1 year ago

Have you tested support on iOS 17? Among my users already have versions of ios 17 (although the off release is tomorrow, September 18), they are experiencing a crash when trying to purchase. It seems in requestPurchase or requestSubscription. Has anyone encountered this problem? On all previous versions of iOS everything works.

Firebase Crashlytics Logs:

Fatal Exception: JavaScriptError
Cannot read property 'transactionReceipt' of undefined

Environment:

dimaischenko commented 1 year ago

Collected more logs. The error also occurs in ios 16.6.1 (and 17.0) , the purchaseUpdatedListener(purchase) method is called with undefined value in purchase after successful subscription

cervebar commented 1 year ago

It may be because of StoreKit 2 they (Apple) changed API and in this library the transactionReceipt was replaced by verificationResultIOS aka jwsRepresentation - see SubscriptionPurchase type.

Best info about this we found in Apple WWDC videos:

dimaischenko commented 1 year ago

@cervebar Thank you for the response! As I understand it, StoreKit 2 is enabled by:

setup({storekitMode: 'STOREKIT2_MODE'})

I didn't set this at all. So by default I am using Store Kit 1. Or am I wrong?

Yann-prak commented 1 year ago

That's right. From the doc: