react-native - 无法回电购买的产品?适用于 React 本机 iOS 的 IAP
问题描述
''''
requestPurchase = async (sku) => {
try {
await RNIap.requestPurchase(sku)
.then(async (result) => {
console.log('IAP req sub', result);
if (Platform.OS === 'android') {
console.log("android")
// can do your API call here to save the purchase details of particular user
} else if (Platform.OS === 'ios') {
console.log("recipt",result.transactionReceipt)
setProductId(result.productId);
setReceipt(result.transactionReceipt);
// can do your API call here to save the purchase details of particular user
}
// setBuyIsLoading(false);
})
.catch((err) => {
//setBuyIsLoading(false);
console.warn(`IAP req ERROR %%%%% ${err.code}`, err.message, isModalVisible);
setError(err.message);
});
console.log("Hiiii......", sku)
} catch (err) {
console.log("Error.....", err.message)
console.warn(err.code, err.message);
}
};
'''
我们要求## 标题 ## 购买产品并能够购买产品但未收到任何产品购买回电。
解决方案
尝试在 then 子句中删除 async before (result)。
推荐阅读
- python - 如何锐化图像以使图像可以被 OCR 读取?
- css - ag-grid webpack css 没有进入网站
- python - 执行 Sympify 时,表达式的顺序切换(Python 的 Sympy)
- python - 在class1中调用class2时出现AttributeError,class1没有__init__属性
- java - 关于 CodeName One 和 Path Java Runtime 的问题
- reactjs - 使用本地存储中的承载令牌
- c++ - 如何在 C++ 中为 std::list 参数设置默认值?
- c++ - 按空格分割字符串并将列输出到不同的数组中
- angular - 如何构建项目以便只有 index.html 位于根目录?
- python - numpy 随机选择和 networkx 图表列表