React-native-iap: getProducts returns empty array in v.2.4.8 in iOS 12.x +

Created on 20 Jun 2019  ·  7Comments  ·  Source: dooboolab/react-native-iap

Version of react-native-iap

2.4.8

Version of react-native

0.55.4

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

iOS 12.x +

Expected behavior

I should get list of products

Actual behavior

I get empty array

Tested environment (Emulator? Real Device?)

Real device -> iPhone SE, iOS 12.3.1
Emulator -> iOS 12.1 (Multiple devices)

Steps to reproduce the behavior

In-App Purchase is created in Ready to Submit status [Non-Consumable]

const itemSkus = Platform.select({
  ios: [
    'my_product_id'
  ],
});

async componentDidMount() {
    await RNIap.initConnection()
    const products = await RNIap.getProducts(itemSkus)
    console.log(products)
}

initConnection returns true
getProducts returns []

Sku array with my_product_id match the one from App Store Connect

I did basically everything from Q/A and different blog posts
without any luck.

Update:
I did some additional debugging and it looks like RNIapIos.getItems(skus) returns []

👣 waiting for response 📱 iOS 🙏 help wanted

Most helpful comment

Thanks @srhtylmz19 fixed it for me!

All 7 comments

Related #407. <== Could you follow the related issue and come back?

@hyochan Right, my Paid Apps agreements was not active but pending .. Closing :)
Thanks for help.

I am facing the same issue, getting an empty array from the getProducts() method.

react-native-iap - 2.4.8 & react native version - 0.56.0.

It is working properly on native iOS with the same id.

How to resolve it?

i strongly suggest you to check out link . i mean controll your build phaese->link binary with libraries (i was not able to see libRNAap.a even i did react-native link react-native-iap) then i linked manually and its working now.

Thanks @srhtylmz19 fixed it for me!

I solved it! I am using these versions,

react-native-iap: ^4.3.0
react-native: 0.60.5

just do it like this

const itemSkus = Platform.select({
    ios: [
        '100coins' // just remove bundle id from product id
    ],
    android: [
        '100coins' // just remove bundle id from product id
    ]
});

I had this issue and it turns out I'd skipped installing the RNIap in the pod file
ie. copy and paste this pod 'RNIap', :path => '../node_modules/react-native-iap' then cd ios && pod install && cd ..(run terminal commands from the application directory)

Was this page helpful?
0 / 5 - 0 ratings