2016-07-19 8 views
2

スイフトを使用してゲームステージのロックを解除するIAPを実装します。 IPv4でうまく動作します。そこで私はこのバイナリを審査のために提出し、AppleがIPv6ネットワーク上でテストしたときに却下されます。 iPhoneは、のWi-Fi上のiOS 9.3.2を実行しているに見直したときに私たちは、IPv6ネットワークに接続されてアプリ内の1つまたは複数のバグを発見しIPV6の影響を受ける非消耗品のiOSアプリ内購入

はバイナリ理由を拒否します。 具体的には、In App Purchaseを購入した後、レベルのロックが解除されません。

私はすべてのケースでブレークポイントを設定しましたが、IPv6ネットワーク上で実行しているときにプログラムが1つも入っていませんでした。

ここでは私のコードは購入できます:

func paymentQueue(queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { 
    print("Received Payment Transaction Response from Apple"); 

    for transaction:AnyObject in transactions { 
     if let trans:SKPaymentTransaction = transaction as? SKPaymentTransaction{ 
      switch trans.transactionState { 
      case .Purchased: 
       print("Product Purchased"); 
       SKPaymentQueue.defaultQueue().finishTransaction(transaction as! SKPaymentTransaction) 
       self.levelButtonHalloween.enabled = true 
       lockImage.removeFromSuperview() 
       Overlay.removeFromSuperview() 
       userSettingDefaults.setBool(true, forKey: "enableHalloween") 
       userSettingDefaults.synchronize() 
       DesertOver50 = userSettingDefaults.boolForKey("enableHalloween") 
       buyBottom.removeFromSuperview() 
       backgroundImage.removeFromParent() 
       backgroundImage = SKSpriteNode(imageNamed: "StageSelect_Background2") 
       backgroundImage.size = self.frame.size 
       backgroundImage.position = CGPoint(x: frame.size.width/2, y: frame.size.height/2) 
       backgroundImage.anchorPoint = CGPointMake(0.5, 0.5) 
       backgroundImage.zPosition = 0 
       addChild(backgroundImage) 
       break; 
      case .Failed: 
       print("Purchase Failed"); 
       SKPaymentQueue.defaultQueue().finishTransaction(transaction as! SKPaymentTransaction) 
       break; 
      case .Restored: 
       print("Transaction restored") 
       SKPaymentQueue.defaultQueue().restoreCompletedTransactions() 
       self.levelButtonHalloween.enabled = true 
       lockImage.removeFromSuperview() 
       Overlay.removeFromSuperview() 
       userSettingDefaults.setBool(true, forKey: "enableHalloween") 
       userSettingDefaults.synchronize() 
       DesertOver50 = userSettingDefaults.boolForKey("enableHalloween") 
       buyBottom.removeFromSuperview() 
       backgroundImage.removeFromParent() 
       backgroundImage = SKSpriteNode(imageNamed: "StageSelect_Background2") 
       backgroundImage.size = self.frame.size 
       backgroundImage.position = CGPoint(x: frame.size.width/2, y: frame.size.height/2) 
       backgroundImage.anchorPoint = CGPointMake(0.5, 0.5) 
       backgroundImage.zPosition = 0 
       addChild(backgroundImage) 
      default: 
       break; 
      } 
     } 
    } 
    SKPaymentQueue.defaultQueue().removeTransactionObserver(self) 
} 

私も購入を復元し、それがIPv4とIPv6の両方のために働くためのボタンを実装します。

ここで購入を復元するためのコード:

func restorePurchaseButtonAction(){ 
    button_Clicked() 
    if (DesertOver50 == false){ 
     if (SKPaymentQueue.canMakePayments()) { 
      // Enable SKPayment as soon as possible during viewdidload 
      SKPaymentQueue.defaultQueue().addTransactionObserver(self) 
      SKPaymentQueue.defaultQueue().restoreCompletedTransactions() 
     } 
    }else{ 
     let alert = UIAlertController(title: "It's already unlocked ¬_¬", message: "Your have already unlocked or purchased the item(s)", preferredStyle: .ActionSheet) 
     let ok = UIAlertAction(title: "OK", style: .Cancel) { action -> Void in 
     } 
     alert.addAction(ok) 
     alert.popoverPresentationController?.sourceView = view 
     alert.popoverPresentationController?.sourceRect = self.frame 
     self.view?.window?.rootViewController?.presentViewController(alert, animated: true, completion: nil) 
    } 
} 

誰でもこの前の経験がありますか? IPv4とIPv6の違いは何ですか?私は次に何をすべきですか?

答えて

1

アプリ内購入が正しく登録されているかどうかを確認しますか?

SKPaymentQueue.defaultQueue()。addTransactionObserver(自己)のviewDidLoadで

を置くことを忘れないでください。この問題は私にも悩まされています。

1

ありがとうございました。私のituneConnectは大丈夫です。

そのSKPaymentQueue.defaultQueue().addTransactionObserver(self)は根本原因 私の問題です。

シナリオ1:

override func didMoveToView(view: SKView) { 
// In-App button and function call 
    if(DesertOver50 == false) { 
     product_id = "xxxxxxxx"; 
     SKPaymentQueue.defaultQueue().addTransactionObserver(self)  
     addBotton(); 

シナリオ失敗> =必要とすることなく、アイテムの自動ロック解除自体アプリ起動ログインする: 項目完全に購入したが、ステージがアンロックではない=>

func buyNonConsumable() { 
    button_Clicked() 
    print("About to fetch the products"); 
    SKPaymentQueue.defaultQueue().addTransactionObserver(self)  
    // We check that we are allow to make the purchase. 
    if (SKPaymentQueue.canMakePayments()) { 
     let productID:NSSet = NSSet(object: self.product_id!); 
     let productsRequest:SKProductsRequest = SKProductsRequest(productIdentifiers: productID as! Set<String>); 
     productsRequest.delegate = self; 
     productsRequest.start(); 
     print("Fething Products"); 
    } else { 
     print("can't make purchases"); 
    } 
} 

は、シナリオ2が失敗3:正常に動作する

私が理解しているものからnario 2は最善の解決策ですが失敗します。 コードは完全に動作しているので、シナリオ3が解決策であると仮定します。

+0

あなたのアプリは承認されましたか?どのような変更を加えましたか? –

+0

はいアプリが承認されました。シナリオ3のようにします。 – Justintas

関連する問題