2016-11-07 109 views
0

我目前正在將遊戲的應用程序內購買模式從較舊的插件更改爲Unity的內置服務。到目前爲止,沒有任何問題測試付款和驗證收據,無論是生活還是使用沙箱帳戶。Unity應用程序內購買本地驗證緩慢

繼統一指南之後,我開發了一家商店,並且可以成功通過沙箱帳戶進行新的支付,但是本地驗證在iPad Air 2上需要大約2分鐘。這是正常的嗎?我們以前的加載項使用App Store驗證了收據數據,並且只花了幾秒鐘。

private bool CheckReceipt() 
    { 
#if UNITY_EDITOR 
     Debug.Log("IAP: Default for editor, receipt valid."); 
     return true; 
#elif UNITY_ANDROID || UNITY_IOS 
     try 
     { 
      CrossPlatformValidator validator = new CrossPlatformValidator(GooglePlayTangle.Data(), 
      AppleTangle.Data(), Application.bundleIdentifier); 
      Product product = controller.products.WithID(ProductID); 
      string receipt = product.receipt; 
      if (receipt == null) 
      { 
       Debug.Log("IAP: No receipt."); 
       return false; 
      } 
      Debug.Log("IAP: Validating receipt...");  
      IPurchaseReceipt[] result = validator.Validate(receipt); 
      return result[0].productID == ProductID; 
     } 
     catch (IAPSecurityException e) 
     { 
      Debug.Log("IAP: Invalid receipt, not unlocking content"); 
      return false; 
     } 
#endif 
    } 

回答

0

在模式「沙盒」這個時候進行驗證很真實,當你改變支付到「戰鬥」模式下,所有站正常

+0

感謝回答我的問題。你能否詳細說明一下?你的意思是時間延遲只是沙盒帳戶的一個問題? –

+0

是的,只適用於Sandbox帳戶 –

+0

可以避免這種延遲嗎?爲了安全起見,在遊戲過程中需要多次檢查收據的有效性,但我們無法讓用戶每次等待2分鐘左右。 –