Prime31 StoreKit Exception

I am trying to get a list of products using a storage set, but I am getting an exception continuously:

Unirradiated Exception: NSInvalidArgumentException: *** - [__ NSPlaceholderDictionary initWithObjects: forKeys: count:]: attempting to insert a null object from objects [4]

This is the stack trace from the console:

0   CoreFoundation                      0x2fa12feb <redacted> + 154
    1   libobjc.A.dylib                     0x3a1bfccf objc_exception_throw + 38
    2   CoreFoundation                      0x2f9514a3 <redacted> + 530
    3   CoreFoundation                      0x2f95126b <redacted> + 50
    4   ninjaworld                          0x016d09d4 +[StoreKitSerializationHelpers jsonStringFromProductArray:] + 1312
    5   ninjaworld                          0x016ceaf4 -[StoreKitManager productsRequest:didReceiveResponse:] + 532
    6   StoreKit                            0x321c4863 <redacted> + 466
    7   libdispatch.dylib                   0x3a6a7833 <redacted> + 10
    8   libdispatch.dylib                   0x3a6a781f <redacted> + 22
    9   libdispatch.dylib                   0x3a6a7777 <redacted> + 254
    10  CoreFoundation                      0x2f9dd8f1 <redacted> + 8
    11  CoreFoundation                      0x2f9dc1c5 <redacted> + 1300
    12  CoreFoundation                      0x2f946f4f CFRunLoopRunSpecific + 522
    13  CoreFoundation                      0x2f946d33 CFRunLoopRunInMode + 106
    14  GraphicsServices                    0x3484b663 GSEventRunModal + 138
    15  UIKit                               0x3229216d UIApplicationMain + 1136
    16  ninjaworld                          0x000dcb5c main + 288
    17  ninjaworld                          0x000dca38 start + 40

      

This exception is thrown before any callback method is called.

The product list is retrieved successfully if I use native iOS code. There are some problems with the plugin. Please tell me how I can debug this code as Prime31 doesn't expose their code.

I have included logs for the plugin. The product list has been successfully restored. The exception is thrown somewhere after this point.

LOG:

-[StoreKitManager requestProductData:]
2014-09-01 07:42:00.702 ninjaworld[2519:60b] SKProductsRequest sent with productIdentifiers: {(
    "com.company.coinpack1",
    "com.company.coinpack4",
    "com.company.coinpack3",
    "com.company.coinpack2",
    "com.company.coinpack5"
)}
2014-09-01 07:42:07.654 ninjaworld[2519:60b] -[StoreKitManager productsRequest:didReceiveResponse:]
2014-09-01 07:42:07.658 ninjaworld[2519:60b] response.products.count: 5
2014-09-01 07:42:07.661 ninjaworld[2519:60b] response.products: (
    "<SKProduct: 0x16df4ca0>",
    "<SKProduct: 0x16df4e10>",
    "<SKProduct: 0x16df5400>",
    "<SKProduct: 0x16df54a0>",
    "<SKProduct: 0x16df5670>"
)

//Exception raised after that

      

Unity code (display only relevant code)

void Start () {

        productsIDs = new string[]
        {
            "com.company.coinpack1",
            "com.company.coinpack2",
            "com.company.coinpack3",
            "com.company.coinpack4",
            "com.company.coinpack5"


        };

        OnEnable ();
        StoreKitBinding.requestProductData(productsIDs);

    }

void OnEnable()
    {
        // Listens to all the StoreKit events. All event listeners MUST be removed before this object is disposed!
        StoreKitManager.transactionUpdatedEvent += transactionUpdatedEvent;
        //StoreKitManager.productPurchaseAwaitingConfirmationEvent += productPurchaseAwaitingConfirmationEvent;
        StoreKitManager.purchaseSuccessfulEvent += purchaseSuccessfulEvent;
        StoreKitManager.purchaseCancelledEvent += purchaseCancelledEvent;
        StoreKitManager.purchaseFailedEvent += purchaseFailedEvent;
        StoreKitManager.productListReceivedEvent += productListReceivedEvent;
        StoreKitManager.productListRequestFailedEvent += productListRequestFailedEvent;

        StoreKitBinding.enableHighDetailLogs (true);

//      StoreKitManager.restoreTransactionsFailedEvent += restoreTransactionsFailedEvent;
//      StoreKitManager.restoreTransactionsFinishedEvent += restoreTransactionsFinishedEvent;
    }

void productListReceivedEvent( List<StoreKitProduct> productList )
    {
        if (productList == null) {

            print("**** It null!!!!");
            return;
                }

        Debug.Log( "productListReceivedEvent. total products received: " + productList.Count );

        // print the products to the console
        foreach( StoreKitProduct product in productList )
            Debug.Log( product.ToString() + "\n" );
    }


    void productListRequestFailedEvent( string error )
    {
        Debug.Log( "productListRequestFailedEvent: " + error );
    }

      

+3


source to share


2 answers


My code was fine. The problem was due to my jailbreak device. I tested my code on another device and it worked well.



0


source


here is the MonoBehavior lifecycle graph, it should come in handy, it talks about 3.4 unity, but its still pretty much the same



monobehavior Lifecycle

+1


source







All Articles