首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Prime31 31的StoreKit异常

Prime31 31的StoreKit异常
EN

Stack Overflow用户
提问于 2014-09-01 07:29:36
回答 2查看 983关注 0票数 3

我正在尝试使用商店工具包接收产品列表,但是我不断地得到一个例外:

未明异常: NSInvalidArgumentException:* -__NSPlaceholderDictionary initWithObjects:forKeys:count::尝试从objects4插入零对象

这是来自控制台的堆栈跟踪:

代码语言:javascript
复制
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

此异常发生在调用任何回调方法之前。

如果使用本机iOS代码,产品列表将成功检索。插件中可能存在一些问题。请指导我如何调试这些代码,因为Prime31不公开它们的代码。

我为插件启用了日志。成功检索了产品列表。异常将在该点之后的某个地方引发。

日志:

代码语言:javascript
复制
-[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

统一代码(只显示相关代码)

代码语言:javascript
复制
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's 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 );
    }
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-09-02 20:06:03

我的密码很好。问题是因为我的越狱装置。我在其他设备上测试了我的代码,效果很好。

票数 0
EN

Stack Overflow用户

发布于 2014-09-02 16:27:59

下面是MonoBehavior生命周期的图表,它应该会派上用场,它说的是统一3.4,但它仍然是一样的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25600822

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档