Ios purchaserInfoUpdateListener从未调用RevenueCat

Ios purchaserInfoUpdateListener从未调用RevenueCat,ios,react-native,in-app-purchase,revenuecat,Ios,React Native,In App Purchase,Revenuecat,我正在使用RevenueCat的React原生SDK 我遵循官方的榜样 我可以在iOS上购买并获得您的所有设置。您的购买成功提示 问题是,purchaserInfoUpdateListener从未被调用,而且购买总是落在catch块中,我无法验证我的代码中是否成功进行了购买 有什么问题吗 async componentDidMount() { try { this.purchaserInfoUpdateListener = (info) => {

我正在使用RevenueCat的React原生SDK

我遵循官方的榜样

我可以在iOS上购买并获得
您的所有设置。您的购买成功
提示

问题是,
purchaserInfoUpdateListener
从未被调用,而且购买总是落在
catch
块中,我无法验证我的代码中是否成功进行了购买

有什么问题吗

async componentDidMount() {
    try {
     
      this.purchaserInfoUpdateListener = (info) => {
          console.log('purchaserInfoUpdateListener:: ', info )
          checkIfPro(info);
      };
     
      this.shouldPurchasePromoProduct = async deferredPurchase => {
        this.deferredPurchase = deferredPurchase;
      };
     
      Purchases.addPurchaserInfoUpdateListener(this.purchaserInfoUpdateListener);
      Purchases.addShouldPurchasePromoProductListener(this.shouldPurchasePromoProduct);

    } catch (e) {
      console.log("Error handling");
    }
}

async componentWillUnmount() {
    Purchases.removePurchaserInfoUpdateListener(this.purchaserInfoUpdateListener);
    Purchases.removeShouldPurchasePromoProductListener(this.shouldPurchasePromoProduct);
}

日志:

[Purchases]-调试:没有缓存的购买者信息,正在获取
[采购]-调试:当前没有运行任何请求,正在启动请求获取
[购买]-DEBUG:GET/v1/subscribers/$RCAnonymousID:f68c1e27ec95489acd081bbf178ebe
[购买]-DEBUG:GET/v1/subscribers/$RCAnonymousID:f68c1e27ec95489acd081bbf178ebe/产品
[购买]-DEBUG:GET/v1/subscribers/$RCAnonymousID:f68c1e27ec95489acd081bbf178ebe/productions 200
[采购]-调试:请求具有标识符的产品:{(
[采购]-调试:产品请求完成
[采购]-调试:有效产品:
[采购]-调试:2567531-
[购买]-调试:com.colorfulNightLight.unlockAllFeatures-
[采购]-调试:无效的产品标识符-(
[采购]-调试:1个等待产品的完成处理程序
[购买]-DEBUG:GET/v1/subscribers/$RCAnonymousID:f68c1e27ec95489acd081bbf178ebe 201
[采购]-调试:向代表发送最新的采购商信息
[购买]-调试:串行请求完成:GET/subscribers/$RCAnonymousID%3Af68c1e27ec9548489acd081bbf178ebe,队列中剩余0个请求
[购买]-调试:从缓存中出售产品
[购买]-调试:从缓存中出售产品
[购买]-调试:从缓存中出售purchaserInfo
[购买]-调试:从缓存中出售purchaserInfo
[采购]-调试:ApplicationIDBecomeActive
[购买]-调试:从缓存中出售产品
[购买]-调试:从缓存中出售产品
[购买]-调试:makePurchase
[购买]-调试:makePurchase-com.colorfulNightLight.unlockAllFeatures-产品:默认
[Purchases]-调试:PaymentQueue updatedTransaction:com.colorfulNightLight.unlockAllFeatures(null)((null))(null)-0
[采购]-调试:ApplicationIDBecomeActive
[采购]-调试:ApplicationIDBecomeActive
[Purchases]-调试:PaymentQueue updatedTransaction:com.colorfulNightLight.unlockAllFeatures 4((null))0-1
[采购]-调试:从中加载收据file:///private/var/mobile/Containers/Data/Application/3C217C29-CDCE-4EBF-966C-
7ADB8B64CF1C/存储套件/沙盒收据
[Purchases]-信息:找到appUserID的0个未同步属性:$RCAnonymousID:f68c1e27ec9548489acd081bbf178ebe
[采购]-调试:当前没有正在运行的请求,正在启动请求发布/接收
[采购]-调试:POST/v1/receipts
[采购]-调试:POST/v1/400
[采购]-错误:收据无效。
[采购]-调试:串行请求完成:POST/receipts,队列中剩余0个请求
[购买]-调试:完成com.colorfulNightLight.unlockAllFeatures 4(0)
[Purchases]-调试:PaymentQueue removedTransaction:com.colorfulNightLight.unlockAllFeatures 4(0(null))(null)-1
[购买]-调试:从缓存中出售产品
[购买]-调试:makePurchase
[购买]-调试:makePurchase-com.colorfulNightLight.unlockAllFeatures-产品:默认
[Purchases]-调试:PaymentQueue updatedTransaction:com.colorfulNightLight.unlockAllFeatures(null)((null))(null)-0
[采购]-调试:ApplicationIDBecomeActive
[采购]-调试:ApplicationIDBecomeActive

从日志中,您收到一个
400错误。收据无效。
发送到RevenueCat时。这是在模拟器还是物理设备上发生的

要在模拟器(iOS 14+)上进行测试,您需要在XCode中创建StoreKit配置,并将证书上载到RevenueCat:

在物理设备上,您不必进行任何额外的设置来测试购买


您可能也有一个损坏的沙盒帐户,您可以尝试在App Store Connect中创建一个新的沙盒用户。

您是否让购买信息更新侦听器工作过?我在Flatter代码中遇到类似问题。不,很遗憾,我不能。我已切换到另一个库。RevenueCat支持团队似乎正在睡觉。好的,谢谢。Which library?我尝试了其他几个Flatter软件包,但它们对订阅处理的支持不及RevenueCat的一半。我只有非消费品,但你说得对,RevenueCat有很多订阅技能。我使用的是
https://github.com/dooboolab/react-native-iap
现在就开始。谢谢你的回复。我在模拟器和真实设备。我创建了StoreKit配置文件,但文档中没有提到将证书上载到RevenueCat,我认为这是一件新鲜事。无论如何,我切换到了另一个库。如果将来切换回RevenueCat,我会尝试。
 onPress={async () => {
    const aPackage = this.state.offerings.current.availablePackages[0];
    
    try {
      const purchaseMade = await Purchases.purchasePackage(aPackage);
      checkIfPro(purchaseMade); //never called
      console.log('purchaseMade:: ',purchaseMade) //never called
    } catch (e) {
      if (!e.userCancelled) {                        
        console.log(`Error handling ${JSON.stringify(e)}`);
      } else {  
        console.log(`User cancelled ${JSON.stringify(e)}`);
      }
    }
 }}
[Purchases] - DEBUG: No cached purchaser info, fetching

[Purchases] - DEBUG: there are no requests currently running, starting request GET 

[Purchases] - DEBUG: GET /v1/subscribers/$RCAnonymousID:f68c1e27ec9548489acd081bbf178ebe

[Purchases] - DEBUG: GET /v1/subscribers/$RCAnonymousID:f68c1e27ec9548489acd081bbf178ebe/offerings

[Purchases] - DEBUG: GET /v1/subscribers/$RCAnonymousID:f68c1e27ec9548489acd081bbf178ebe/offerings 200

[Purchases] - DEBUG: Requesting products with identifiers: {(

[Purchases] - DEBUG: Products request finished

[Purchases] - DEBUG: Valid Products:

[Purchases] - DEBUG: 2567531 - <SKProduct: 0x281753720>

[Purchases] - DEBUG: com.colorfulNightLight.unlockAllFeatures - <SKProduct: 0x281753740>

[Purchases] - DEBUG: Invalid Product Identifiers - (

[Purchases] - DEBUG: 1 completion handlers waiting on products

[Purchases] - DEBUG: GET /v1/subscribers/$RCAnonymousID:f68c1e27ec9548489acd081bbf178ebe 201

[Purchases] - DEBUG: Sending latest purchaser info to delegate

[Purchases] - DEBUG: serial request done: GET /subscribers/$RCAnonymousID%3Af68c1e27ec9548489acd081bbf178ebe, 0 requests left in the queue

[Purchases] - DEBUG: Vending offerings from cache

[Purchases] - DEBUG: Vending offerings from cache

[Purchases] - DEBUG: Vending purchaserInfo from cache

[Purchases] - DEBUG: Vending purchaserInfo from cache

[Purchases] - DEBUG: applicationDidBecomeActive

[Purchases] - DEBUG: Vending offerings from cache

[Purchases] - DEBUG: Vending offerings from cache

[Purchases] - DEBUG: makePurchase

[Purchases] - DEBUG: makePurchase - com.colorfulNightLight.unlockAllFeatures - Offering: Default

[Purchases] - DEBUG: PaymentQueue updatedTransaction: com.colorfulNightLight.unlockAllFeatures (null) ((null)) (null) - 0

[Purchases] - DEBUG: applicationDidBecomeActive

[Purchases] - DEBUG: applicationDidBecomeActive

[Purchases] - DEBUG: PaymentQueue updatedTransaction: com.colorfulNightLight.unlockAllFeatures 4 ((null)) 0 - 1

[Purchases] - DEBUG: Loaded receipt from file:///private/var/mobile/Containers/Data/Application/3C217C29-CDCE-4EBF-966C-
7ADB8B64CF1C/StoreKit/sandboxReceipt

[Purchases] - INFO: found 0 unsynced attributes for appUserID: $RCAnonymousID:f68c1e27ec9548489acd081bbf178ebe

[Purchases] - DEBUG: there are no requests currently running, starting request POST /receipts

[Purchases] - DEBUG: POST /v1/receipts

[Purchases] - DEBUG: POST /v1/receipts 400

[Purchases] - ERROR: The receipt is not valid.

[Purchases] - DEBUG: serial request done: POST /receipts, 0 requests left in the queue

[Purchases] - DEBUG: Finishing com.colorfulNightLight.unlockAllFeatures 4 (0)

[Purchases] - DEBUG: PaymentQueue removedTransaction: com.colorfulNightLight.unlockAllFeatures 4 (0 (null)) (null) - 1

[Purchases] - DEBUG: Vending offerings from cache

[Purchases] - DEBUG: makePurchase

[Purchases] - DEBUG: makePurchase - com.colorfulNightLight.unlockAllFeatures - Offering: Default

[Purchases] - DEBUG: PaymentQueue updatedTransaction: com.colorfulNightLight.unlockAllFeatures (null) ((null)) (null) - 0

[Purchases] - DEBUG: applicationDidBecomeActive

[Purchases] - DEBUG: applicationDidBecomeActive