question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'canMakePayments' of undefined in IOS

See original GitHub issue

Version of react-native-iap

“react-native-iap”: “1.3.0”,

Platforms you faced the error (IOS or Android or both?)

both

Expected behavior

Must be called on Android before any other purchase flow methods. In ios, it will simply call canMakePayments method and return value.

Actual behavior

TypeError: Cannot read property ‘canMakePayments’ of undefined in IOS

Tested environment (Emulator? Real Device?)

Real Device: Iphone 6, ios 10.3.3

Steps to reproduce the behavior

import * as RNIap from 'react-native-iap';

then:
const itemSkus = Platform.select({
  ios: [
    'app.xxx.xxx.xxxPurchase'
  ],
  android: [
    'xxx
  ]
});

in component class: 
async componentDidMount() {
    try {
      await prepare();
    } catch(err) {
      console.warn(err); // standardized err.code and err.message available
    }
  }

and once i get into this screen appears error that “TypeError: Cannot read property ‘canMakePayments’ of undefined in IOS”

Thank you!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
hyochancommented, Jul 30, 2018

@bigchamp Could you update our module (currently it’s version in 1.3.5) and try to unlink and link again? It is because react-native-iap isn’t linked properly to your project.

0reactions
louiskhenghaocommented, Aug 2, 2018

reinstall the package and relinking solved my issue 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot ready property 'container' of null" when using musicKit
Solution: In chrome at least, musicKit.js requires that the site being hosted is using SSL. This was not a problem for me running...
Read more >
TypeError: 'Arguments', 'callee' and 'caller' cannot be ...
I am trying to make a payment request while passing all required fields, but it throws a type error. I want to create...
Read more >
PaymentRequest.canMakePayment() - Web APIs | MDN
A Promise to a boolean value that resolves to true if the user agent supports any of the payment methods supplied when instantiating...
Read more >
react-native-apple-pay - Bountysource
... this warning message "TypeError: Cannot read property 'createPaymentRequest' of undefined" And I cannot use the show method, this happens me only in...
Read more >
dooboolab/react-native-iap (Raised $40.00) - Issuehunt
Types: type on Subscription different on iOS: "Do not use this. ... [RNIAP - 3.5.1]Cannot read property 'getItemsByType' of undefined when using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found