React-native-iap: TypeError: Cannot read property 'canMakePayments' of undefined in IOS

Created on 30 Jul 2018  路  6Comments  路  Source: dooboolab/react-native-iap

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!

馃摫 iOS 馃檹 help wanted

Most helpful comment

@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.

All 6 comments

@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.

i am facing exact same issue, the version i've installed was 1.3.5 (tried on emulator)

@louiskhenghao Did you tried example project?

Had the same issue, relinking solved it.

Yeah. It should be the linking issue. The linking is not perfect in react-native. You should go over manual linking when not working as expected.

reinstall the package and relinking solved my issue :D

Was this page helpful?
0 / 5 - 0 ratings