You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following component functions nominally under Android. We thought we were cool.
But, the same code on iOS hangs when it tries to get subscriptions. The request doesn't succeed, doesn't fail, doesn't crash. The JS promise is seemingly never resolved or rejected.
Has anyone experienced this? Any ideas on what I should try next?
This is running on my 100% real iPhone logged into my Apple account tethered to my MacBook Pro. There don't appear to be any other issues regarding this phone's ability to make purchases.
Logs
LOG [Subscription] Will init connection
LOG [Subscription] Did init connection
LOG [Subscription] Will clear transaction ios
LOG [Subscription] Did clear transaction ios
LOG [Subscription] Will get subscription
...then nothing, I've waited over 5 minutes...
Component JSX
importReact,{Component}from"react";import{Platform,Text,TouchableOpacity}from"react-native";import*asSentryfrom"@sentry/react-native";import*asRNIapfrom"react-native-iap";import{Subscription,SubscriptionPurchase}from"react-native-iap/src/types";import{SUBSCRIPTION_ID}from"../env";classSubscriptionScreenextendsComponent{state={subscription: undefined,available: undefined,};constructor(props){super(props);}asynccomponentDidMount(){try{console.log('[Subscription]','Will init connection');awaitRNIap.initConnection();console.log('[Subscription]','Did init connection');if(Platform.OS==='ios'){console.log('[Subscription]','Will clear transaction ios');awaitRNIap.clearTransactionIOS();console.log('[Subscription]','Did clear transaction ios');}console.log('[Subscription]','Will get subscription');constsubscription: Subscription=(awaitRNIap.getSubscriptions([SUBSCRIPTION_ID])).find(s=>s.productId===SUBSCRIPTION_ID);console.log('[Subscription]','Did get subscription',subscription);console.log('[Subscription]','Will get available');constavailable: SubscriptionPurchase=(awaitRNIap.getAvailablePurchases([SUBSCRIPTION_ID])).find(p=>p.productId===SUBSCRIPTION_ID);console.log('[Subscription]','Did get available',available);this.setState({subscription, available});}catch(err){console.error('Failed to get subscriptions!',err.code,err.message);Sentry.captureException(err);}}asynccomponentWillUnmount(){console.log('[Subscription]','Will close connection');awaitRNIap.endConnection();console.log('[Subscription]','Did close connection');}asyncpurchaseSubscription(){try{awaitRNIap.requestSubscription(SUBSCRIPTION_ID);}catch(err){console.error('Failed to purchase subscriptions!',err.code,err.message);Sentry.captureException(err);}}render(){if(this.state.available)return(<Text>You're a subscriber!</Text>)elsereturn(<TouchableOpacityonPress={this.purchaseSubscription}><Text>Subscribe</Text></TouchableOpacity>)}}exportdefaultSubscriptionScreen;
The following component functions nominally under Android. We thought we were cool.
But, the same code on iOS hangs when it tries to get subscriptions. The request doesn't succeed, doesn't fail, doesn't crash. The JS promise is seemingly never resolved or rejected.
Has anyone experienced this? Any ideas on what I should try next?
This is running on my 100% real iPhone logged into my Apple account tethered to my MacBook Pro. There don't appear to be any other issues regarding this phone's ability to make purchases.
Logs
Component JSX
Dependencies
Stack Overflow
Also posted this to https://stackoverflow.com/questions/72466947/react-native-iap-just-hangs-on-ios-trying-to-get-subscriptions-on-ios
The text was updated successfully, but these errors were encountered: