• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by borzly · Aug 29, 2016 at 03:19 PM · c#2d

IOS app rejected due to unity IAP IPV6 Issue.

Its literally my first game!
notes:
- IAP functioning 100% on android!
- button dims when pressed so clearly it shows if its clicked or not.
- once button is pressed it also clearly shows its already owned non-consumable.
- when I turn my mac to IPV6 router.. then connect my iphone to it .. then I test the button again nothing happens!

code:

 using System;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Purchasing;
 
 
     // Deriving the Purchaser class from IStoreListener enables it to receive messages from Unity Purchasing.
     public class MyIAPManager1 : MonoBehaviour, IStoreListener
     {
         private static IStoreController m_StoreController;
         private static IExtensionProvider m_StoreExtensionProvider;
         void Start()
         {
             if (m_StoreController == null)
             {
                 InitializePurchasing();
             }
         }
 
         public void InitializePurchasing()
         {
             if (IsInitialized())
             {
                 return;
             }
                 var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
         builder.AddProduct("TankCannon", ProductType.NonConsumable, new IDs() { { "tankcannon5", GooglePlay.Name },{"TankCannon5", AppleAppStore.Name}});
         builder.AddProduct ("continue", ProductType.Consumable, new IDs{ { "continue1", GooglePlay.Name } ,{"continue1", AppleAppStore.Name}});
                 UnityPurchasing.Initialize(this, builder);
         }
 
 
         private bool IsInitialized()
         {
             return m_StoreController != null && m_StoreExtensionProvider != null;
         }
 
     
     public void BtnBuyTankCannon5()
     {
         BuyProductID("TankCannon");
     }
 
     public void BtnBuyContinue1(){
         BuyProductID ("continue");
     }
     public void BuyNonConsumable()
         {
             // Buy the non-consumable product
         }
         public void BuySubscription()
         {
             // Buy the subscription product using its the general identifier. 
         }
         void BuyProductID(string productId)
         {
             try
             {
                 if (IsInitialized())
                 {
                     Product product = m_StoreController.products.WithID(productId);
                     if (product != null && product.availableToPurchase)
                     {
                         Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
                         m_StoreController.InitiatePurchase(product);
                     }
                     else
                     {
                         Debug.Log("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
                     }
                 }
                 else
                 {
                     Debug.Log("BuyProductID FAIL. Not initialized.");
                 }
             }
             catch (Exception e)
             {
                 Debug.Log("BuyProductID: FAIL. Exception during purchase. " + e);
             }
         }
         public void RestorePurchases()
         {
             if (!IsInitialized())
             {
                 Debug.Log("RestorePurchases FAIL. Not initialized.");
                 return;
             }
             if (Application.platform == RuntimePlatform.IPhonePlayer ||
                 Application.platform == RuntimePlatform.OSXPlayer)
             {
                 Debug.Log("RestorePurchases started ...");
                 var apple = m_StoreExtensionProvider.GetExtension<IAppleExtensions>();
                 apple.RestoreTransactions((result) => {
                     Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
 
                 });
             }
             else
             {
                 Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
             }
         }
         public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
         {
             Debug.Log("OnInitialized: PASS");
             m_StoreController = controller;
             m_StoreExtensionProvider = extensions;
         }
 
 
         public void OnInitializeFailed(InitializationFailureReason error)
         {
             Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
         }
 
 
     public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
     {
         if (String.Equals(args.purchasedProduct.definition.id, "continue", StringComparison.Ordinal))
         {
             Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
             Debug.Log ("CONSUMABLE ADDED 10");
             this.GetComponent<_ManagerScript>().SuccessfulBulletsContinue();
         } 
         else 
         if (String.Equals(args.purchasedProduct.definition.id, "TankCannon", StringComparison.Ordinal))
         {
             Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
             Debug.Log("this is TankCannon Success");
             PlayerPrefs.SetInt("Tank_Bang_Cannon_Add", 5);
             this.GetComponent<__ManMenu>().ShowCongratulationsMessage();
         }
 
         else
         {
             Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
         }
         return PurchaseProcessingResult.Complete;
     }
         
         public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
         {
             // A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing this reason with the user.
             Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
         }
 }



Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ross_S · Aug 30, 2016 at 04:01 PM 0
Share

I"ve got the same issue.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

243 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

HLAPI simple 2 player game 1 Answer

He wants to write a script on a page change gait from right to left or vice versa 0 Answers

Random position, overlap problem. 1 Answer

Stuck inside of Composite Collider when using Platform Effector 2D 2 Answers

how I change this C code for 2D 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges