首页 > 解决方案 > RNIap.getProducts(itemSku) 返回空数组

问题描述

我正在使用这个包react-native-admob

我创建了我的应用程序的 alpha 轨道,并在播放控制台上创建了一个托管产品

如果我尝试

RNIap.prepare()

我得到错误

RNIap.prepare is not a function. (In 'RNIap.prepare()', 'RNIap.prepare' is undefined)

如果我尝试

const itemSkus = Platform.select({
  ios: [
    my_product_id
  ],
  android: [
    my_product_id
  ]
});
const products = await RNIap.getProducts(itemSkus);
console.log(products)

我明白了

Array []

我缺少任何其他设置吗?这是我第一次在 react-native 上使用应用内购买


我一直在学习本教程,但是当我开始学习时遇到了问题RNIap.prepare()。我的应用程序使用的是 Expo 管理的工作流程,现在使用的是裸工作流程。我仍在使用 expo start 运行我的应用程序,因为我不知道我还能做些什么来运行它。

标签: reactjsreact-nativein-app-purchase

解决方案


Have you followed these steps in the document rn-iap? This was the document which i followed and implemnted in app purchase for both android and ios in react native. It explains easily and beautifully. Do check it out.

ps: Even my app is in production and it has succesfull in app purchase


推荐阅读