React Native Android端内购功能报错求助(iOS端正常)
React Native 应用内购iOS端正常,Android真机订阅购买报错
我的React Native应用内购功能在iOS端运行完全正常,但在Android真机上执行订阅购买时出现报错,报错截图如下:

以下是我实现订阅购买的核心代码:
const handleBuySubscription = async (productId, planType) => { setIsRequestInProgress(true); try { const offer = subscriptionOffers[productId]?.[planType]; console.log("Selected Product ID:", productId); console.log("Selected Plan Type:", planType); console.log("Offer:", offer); if (Platform.OS === 'android' && offer && offer.basePlanId && offer.offerId) { try { await requestSubscription({ sku: productId, subscriptionOffers: [{ basePlanId: offer.basePlanId, offerId: offer.offerId }], }); } catch (error) { console.error("Error during requestSubscription:", error); } } else if (Platform.OS === 'ios') { await requestSubscription({ sku: productId }); } else { throw new Error("Invalid subscription offer details."); } setLoading(false); setIsRequestInProgress(false); } catch (error) { setLoading(false); setIsRequestInProgress(false); if (error instanceof PurchaseError) { console.error(`[${error.code}]: ${error.message}`, error); } else { console.error("handleBuySubscription", error); } } };
我已经尝试过替换成requestPurchase方法调用,但问题依然存在。想问问有没有其他开发者遇到过相同的问题?
内容的提问来源于stack exchange,提问作者Dev07
相关产品推荐
相关产品推荐

