Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17070

SDKbox of iOS IAP plugin sdk crashed

$
0
0

@debuger wrote:

sdkbox -v


|______ | \ |____/ |___] | | _/
______| |_____/ | _ |_____] |_____| _/ _
Copyright (c) 2015 SDKBOX Inc. v1.0.0.9


I download the sdkbox-iap_v2.1.1.2.tar.gz ,and integrated it to my iOS project.
But the iOS sdk crashed . I use the latest sdkbox v2.1.1.2, cocos 2d 3.9, and Xcode 7.3 , mac os 10.11.4 . I use a popup layer to show IAP, but it crash at the following function when I popup the iap layer and close it several times (general 4~7 times).
void GameIAPLayer::onProductRequestSuccess(const std::vector &products)
{
updateIAP(products);
}

void GameIAPLayer::updateIAP(const std::vector& products)
{

_products = products; //crashed here

for (int i=0; i < _products.size(); i++)
{
    CCLOG("IAP: ========= IAP Item =========");
    CCLOG("IAP: Name: %s", _products[i].name.c_str());
    CCLOG("IAP: ID: %s", _products[i].id.c_str());
    CCLOG("IAP: Title: %s", _products[i].title.c_str());
    CCLOG("IAP: Desc: %s", _products[i].description.c_str());
    CCLOG("IAP: Price: %s", _products[i].price.c_str());
    CCLOG("IAP: Price Value: %f", _products[i].priceValue);

    std::string str=StringUtils::format("Button_Buy_%d",i+1);
    Button * btnBuy=(Button *)rootNode->getChildByName(str);

    btnBuy->addClickEventListener(CC_CALLBACK_1(GameIAPLayer::onIAP, this));

    btnBuy->setUserData(&_products[i]);

}

}

the log is as below:
==650==ERROR: AddressSanitizer: heap-use-after-free on address 0x1b3451c8 at pc 0x000b04dc bp 0xbff75948 sp 0xbff75944
READ of size 4 at 0x1b3451c8 thread T0

#0 0xb04db in std::1::enable_if<(is_forward_iterator::value) && (is_constructible1::iterator_traits::reference>::value), void>::type std::1::vector >::assign(sdkbox::Product*, sdkbox::Product*) vector:371
#1 0x9fc8b in GameIAPLayer::updateIAP(std::1::vector1::allocator > const&) vector:1354
#2 0xa1483 in GameIAPLayer::onProductRequestSuccess(std::1::vector1::allocator > const&) GameIAPLayer.cpp:261
#3 0xa14b8 in non-virtual thunk to GameIAPLayer::onProductRequestSuccess(std::1::vector1::allocator > const&) GameIAPLayer.cpp:259
#4 0x2e176ce in sdkbox::IAPWrapper::onProductRequestResult(sdkbox::ProductRequestCode, char const*, char const*) (myProject-mobile+0x2d906ce)
#5 0x2e1c9bb (myProject-mobile+0x2d959bb)
#6 0x2e1a9d3 (myProject-mobile+0x2d939d3)
#7 0x5a6487e in _34-[SKProductsRequest _handleReply:]block_invoke (StoreKit+0x987e)
#8 0x43e37ec in _wrapdispatch_async_block_invoke (libclang_rt.asan_iossim_dynamic.dylib+0x4d7ec)
#9 0xac1d362 in dispatchcall_block_and_release (libdispatch.dylib+0x2362)
#10 0xac409cc in dispatchclient_callout (libdispatch.dylib+0x259cc)
#11 0xac25f7b in dispatchmain_queue_callback_4CF (libdispatch.dylib+0xaf7b)
#12 0xa44f1bd in CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE (CoreFoundation+0xb11bd)
#13 0xa40d433 in __CFRunLoopRun (CoreFoundation+0x6f433)
#14 0xa40c845 in CFRunLoopRunSpecific (CoreFoundation+0x6e845)
#15 0xa40c65a in CFRunLoopRunInMode (CoreFoundation+0x6e65a)
#16 0xbc5b663 in GSEventRunModal (GraphicsServices+0xe663)
#17 0xbc5b4a0 in GSEventRun (GraphicsServices+0xe4a0)
#18 0x6790eb8 in UIApplicationMain (UIKit+0x29eb8)
#19 0x1d4ff6 in main main.m:6
#20 0xac6aa24 in start (libdyld.dylib+0x2a24)
#21 0x0 ()

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 17070

Trending Articles