Using hooks, getting Not initialized, Please call initConnection()
See original GitHub issuePlease use Discussion board if you want get some help out of it. Please report issue if there is a bug.
Version of react-native-iap
7.5.0
Version of react-native
0.63.4
Platforms you faced the error (IOS or Android or both?)
Android only
Expected behavior
I should not have to call initConnection using hooks
Actual behavior
After connected
is true we getSubscriptions(ids)
but it throws an error Not initialized, Please call initConnection()
Tested environment (Emulator? Real Device?)
Real device
Steps to reproduce the behavior
App.js is wrapped and exported as withIAPContext(App)
The code:
export const useSubscription = () => {
// initConnection(); // <-- In dev, this will avoid the error. Not in production.
const {
connected,
subscriptions,
finishTransaction,
getSubscriptions,
currentPurchase,
currentPurchaseError,
} = useIAP();
...
useEffect(() => {
if (connected) {
getSubscriptions(subscriptionIds).catch((err) => { // <-- Error here
Sentry.Native.captureException(err)
});
}
}, [connected]);
...
Issue Analytics
- State:
- Created 2 years ago
- Comments:18
Top Results From Across the Web
How to use the react-native-iap.initConnection function in ...
To help you get started, we've selected a few react-native-iap.initConnection examples, based on popular ways it is used in public projects.
Read more >RenOkimoto@ベリロン on Twitter: "hooks 使ってたら ...
Using hooks, getting Not initialized, Please call initConnection() · Issue #1526 · dooboolab/reac... Please use Discussion board if you want ...
Read more >Announcing React Native IAP hooks | by Hyo - Medium
With useIAP hook, these are handled automatically. You do not have to call initConnection imperatively and calling useIAP() is enough for ...
Read more >React Native IAP - Javatpoint
To initialize a native module, you can call initConnection() at the beginning of your application's lifecycle. It must be done on a top-level...
Read more >react-native-iap just hangs on ios trying to get subscriptions on ...
There don't appear to be any other issues regarding this phone's ability to make purchases. Logs. LOG [Subscription] Will init connection LOG [ ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Still an ongoing issue for me, any help?
@andresesfm I found another issue and saw that I wasn’t connected to the play store.