我正在使用收入猫进行应用内购买我想添加“每月订阅”,所以我按照文档进行配置。并按照他们编写的方式设置所有内容。
对于代码部分
在 App.js 中
import Purchases from 'react-native-purchases';
export default class App extends React.Component {
componentDidMount() {
...
Purchases.setDebugLogsEnabled(true);
Purchases.setup('apiKey');
}
......
}
这里是一个特定的屏幕 这里我应该返回价格、名称、时间“每月”和其他数据(显示产品)
import React, {Component} from 'react';
import {View, Text} from 'react-native';
import Purchases from 'react-native-purchases';
export default class OneMonthPurchases extends Component {
getOfferings = async () => {
try {
const offerings = await Purchases.getOfferings();
console.log('offerings', offerings); // offerings: {"all": {}}
} catch (error) {
console.log('error when get offerings', error);
}
};
componentDidMount() {
this.getOfferings();
}
render() {
return (
<View>
<Text>One Month Purchases</Text>
</View>
);
}
}
但是当我登录优惠时我得到了offerings: {"all": {}}
那么我该如何解决它或者我错过了什么?
注意:我在模拟器上测试