崩溃日志,从iap获取产品列表

时间:2013-10-31 07:16:59

标签: ios crash cocos2d-x in-app-purchase

我的应用用户收到了崩溃日志。此用户想要打开IAP产品列表,然后我的应用程序崩溃了。我查看了日志和我的代码。我不知道为什么我的应用程序崩溃了。

Incident Identifier: 7D3A789B-8E4A-40BA-BF10-B0387707E2E7
CrashReporter Key:   da62ff31c65c542560bc99919be673cc101c6962
Hardware Model:      iPhone5,2
Process:             bomb [2828]
Path:                /var/mobile/Applications/5CB84CE5-CA70-4D26-954A-3E22756754E5/bomb.app/bomb
Identifier:          com.lmj.bomb
Version:             5 (1.0.8)
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2013-10-31 11:15:13.146 +0800
OS Version:          iOS 7.0.2 (11A501)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x2f871e86 0x2f79d000 + 872070
1   libobjc.A.dylib                 0x39b6c6c2 0x39b64000 + 34498
2   CoreFoundation                  0x2f871dc8 0x2f79d000 + 871880
3   bomb                            0x00723b7c SignalHandler + 132
4   libsystem_platform.dylib        0x3a17e716 0x3a17b000 + 14102
5   libsystem_pthread.dylib         0x3a183a4e 0x3a180000 + 14926
6   libsystem_c.dylib               0x3a0cd028 0x3a083000 + 303144
7   libc++abi.dylib                 0x3951b98a 0x3951b000 + 2442
8   libc++abi.dylib                 0x395321f4 0x3951b000 + 94708
9   libc++abi.dylib                 0x39531a04 0x3951b000 + 92676
10  libstdc++.6.dylib               0x39ea74ae 0x39ea1000 + 25774
11  libstdc++.6.dylib               0x39ecc52a 0x39ea1000 + 177450
12  libstdc++.6.dylib               0x39ed6264 0x39ea1000 + 217700
13  bomb                            0x003a7d22 -[IAPManager productsRequest:didReceiveResponse:] (IAPManager.mm:115)
14  StoreKit                        0x31f8d132 0x31f86000 + 28978
15  libdispatch.dylib               0x3a0510fe 0x3a050000 + 4350
16  libdispatch.dylib               0x3a0510ea 0x3a050000 + 4330
17  libdispatch.dylib               0x3a0539a4 0x3a050000 + 14756
18  CoreFoundation                  0x2f83c5b4 0x2f79d000 + 652724
19  CoreFoundation                  0x2f83ae80 0x2f79d000 + 646784
20  CoreFoundation                  0x2f7a553c 0x2f79d000 + 34108
21  CoreFoundation                  0x2f7a531e 0x2f79d000 + 33566
22  GraphicsServices                0x344dc2e6 0x344d5000 + 29414
23  UIKit                           0x3205c1e0 0x31fec000 + 459232
24  bomb                            0x000a312a main (main.m:14)
25  bomb                            0x0009dcb4 start + 36

我重新象征了日志并找到了一些线索

[IAPManager productsRequest:didReceiveResponse:] (IAPManager.mm:115)

第115行

wrapProduct->setLocalizedTitle(ccs([product.localizedTitle UTF8String]));

以下是方法代码

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{

    //NSArray *myProducts = response.products;
    NSArray *myProducts = response.products;
    //NSLog(@"产品Product ID:%@",response.invalidProductIdentifiers);
    //NSLog(@"产品付费数量: %d", [myProducts count]);
    // populate UI
    IAPClient::sharedIAPClient()->getProductList()->removeAllObjects();

    myProducts=[myProducts sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
        SKProduct *p1=obj1;
        SKProduct *p2=obj2;
        return [p1.price compare:p2.price];
        //        if ( [p1.price compare:p2.price] ) {
        //            return (NSComparisonResult)NSOrderedAscending;
        //        } else {
        //            return (NSComparisonResult)NSOrderedDescending;
        //        }
    }];
    for(SKProduct *product in myProducts){
        Product *wrapProduct=new Product;
        wrapProduct->setProductIdentifier(ccs([product.productIdentifier UTF8String]));
        wrapProduct->setLocalizedTitle(ccs([product.localizedTitle UTF8String]));
        wrapProduct->setLocalizedDescription(ccs([product.localizedDescription UTF8String]));
        wrapProduct->setLocalizedPrice(ccs([[product localizedPrice] UTF8String]));
        wrapProduct->setPrice([product.price floatValue]);
        IAPClient::sharedIAPClient()->getProductList()->addObject(wrapProduct);
        wrapProduct->release();
    }

    [request autorelease];
    IAPClient::sharedIAPClient()->gotProductData();
}

我不知道。谁能给我一些建议?

1 个答案:

答案 0 :(得分:2)

Apple正在为product.localizedTitle返回零值。我们也在多个游戏中看到了这一点。这是昨晚刚刚开始发生的新事(BAD!)行为。