【问题标题】:Unable to call back for purchased products ?IAP for React native iOS无法回调购买的产品?适用于 React 本机 iOS 的 IAP
【发布时间】:2021-07-15 08:51:09
【问题描述】:
''''
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);
        }
    };    
'''

我们正在请求## 标题 ## 购买产品并且能够购买该产品但没有收到任何产品购买回电。

【问题讨论】:

  • 您是否添加了听众以获取购买更新?

标签: react-native in-app-purchase react-native-ios react-native-iap


【解决方案1】:

尝试删除 then 子句中的 async before (result)。

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-01
相关资源
最近更新 更多