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.

getProducts always returns an empty array on iOS

See original GitHub issue

Version of react-native-iap

0.3.0-beta5

Expected behavior

Should return an array of purchasable products just like in Android.

Actual behavior

Returns an empty array.

Steps to reproduce the behavior

var purchase_ids = {
  ios: [
    'pro'
  ],
  android: [
    'pro'
  ]
};

return RNIap.prepare()
  .then(() => RNIap.getProducts(Platform.select(purchase_ids)))
  .then(items => {
    if (__DEV__) console.log('RNIap Products:', items);
  });

Yes I do have the in app purchases set up in iTunes Connect:

screen shot 2018-04-03 at 10 08 46 am

And again, this works perfect on Android.

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
kodiecommented, Apr 6, 2018

@dooboolab Between changing the status to “Waiting for Review” and also making sure that I had contracts under “Paid Applications” submitted, I’ve got it working. Thank you so much for your assistance and your react native module!

2reactions
booboothefoolcommented, Sep 28, 2018

@dooboolab @kodie I was able to get it working.

There is wrong information floating all over these issues such as:

  • requires a particular status => it does not. my status is fresh with “1.0 Prepare for Submission”
  • need it import as import * as RNIap from 'react-native-iap'; => it doesn’t matter. import RNIap from 'react-native-iap'; works too
  • products should be listed as product, not com.company.product => false. com.company.product works too

I believe what got it working for me was submitting my Paid Applications contract. This also enabled “Auto-renewable Subscriptions” for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-iap getProducts return empty array - Stack Overflow
For those facing this issue with iOS, make sure you finalise the agreements and tax, then make sure to copy and paste this...
Read more >
[Solved]-React-Native-iap getProducts() returns empty array
When products aren't fetched, it's most likely some configuration issue. On iOS the most likely culprits are: The products are not in the...
Read more >
[EXPO] How to fetch products from RevenueCat? Why does ...
getProducts (['productId']) return empty array? ... Fetching all products by passing an array of their product_id const products = await ...
Read more >
Cannot get array of products / subscriptions #651 - Issuehunt
getProducts and RNIap.getSubscriptions always return empty arrays. Tested environment (Emulator? Real Device?) iOS simulator, Android emulator and Android real ...
Read more >
Function returns an empty array bu… | Apple Developer Forums
If I try to print the NSMenu "sub" then it's always empty and also if I change the output from loadRSS to a...
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