expo: Unable to connect to Expo In App purchases for android default.connectAsync not defined.
🐛 Bug Report
Unable to connect to InAppPurchases following the documentation.
Environment
Expo CLI 3.17.21 environment info: System: OS: macOS 10.15.2 Shell: 3.2.57 - /bin/bash Binaries: Node: 12.13.0 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.12.0 - /usr/local/bin/npm IDEs: Android Studio: 3.5 AI-191.8026.42.35.5900203 Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild npmPackages: expo: ^36.0.2 => 36.0.2 react: ~16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4 react-navigation: ^4.3.7 => 4.3.7 npmGlobalPackages: expo-cli: 3.17.21
AndroidSteps to Reproduce
I performed
npm install expo-in-app-purchases
npm install react-native-unimodules
In my LoadingScreen.js
import * as InAppPurchases from 'expo-in-app-purchases';
componentDidMount() {
this.getDetails()
}
getDetails = async () => {
const history = await InAppPurchases.connectAsync();
}
Actual Behavior
I am getting undefined is not an object (evaluating ‘_ExpoInAppPurchases.default.connectAsync’) if I use
await InAppPurchases.connectAsync();
however if i simply do
await connectAsync();
I get
Can’t find variable: connectAsync
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 25 (3 by maintainers)
@fulljsdev259 Yes, you have to eject expo to bare workflow. Only then it will work unfortunately.
@dorapax-lab no shit. in a month, please tell me again it’s only available in bare workflow.
Has there been any movement on this? I am completely unable to connect to the store. The below is what I ran and what showed up in my terminal after hitting the button on my physical device.
Results in:
Any and all help would be greatly appreciated.
This is expo sdk’s current limitation and for now only solution is bare work 😕 .
There’s a feature request for managed workflow and it’s marked as Planned: https://expo.canny.io/feature-requests/p/in-app-purchases
@gwalshington FYI With EAS CLI you can build and submit native project in just a few commands. to learn more: https://www.youtube.com/watch?v=7E6zsRpfT4U docs: http://docs.expo.io/eas
Let’s hope this will be prioritised and implemented soon. Also don’t forget to give a thumbs up for above feature request.
@dorapax-lab It’s already ejected, which is why
react-native-iapworks. Worked out of the box - could not getexpo-in-app-purchasesto work. I stand by my previous comment that connecting was returning undefined with expo’s iap. I’ve decided not to use that package for this reason, but from what I can tell there are many others experiencing this issue.@captivatingLunatic, change BillingClint version here. If you are going to use react-native-iap, I using version 7.0.2 and it works very well! Cheers!
I tried both plugins expo-in-app-purchases and react-native-iap. On rn-iap it returns
Possible Unhandled Promise Rejection (id: 3): Error: E_IAP_NOT_AVAILABLand at the expo it return[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_ExpoInAppPurchases.default.connectAsync')]. I’m using ejected expo or bare workflow, the same setup.@byCedric I have tried these and none of that worked for me 😦
Is there any workaround for this without ejecting expo to bare workflow ?