环境android-ndk-r8e cocos2d-2.1rc0-x-2.1.3
我先用CCTextureCache异步加载一个图片缓存,然后在回调函数里用texture和plist文件生成SpriteFrameCache,在ios里没问题,在android里会崩溃。
我很困扰啊,下面是我的代码。
void LoadingScene::onEnterTransitionDidFinish(){
//android & iOS OK
CCTextureCache::sharedTextureCache()->addImageAsync("Mahjong_All.png", this, callfuncO_selector(LoadingScene::addImageAsyncCallBack));
}
void LoadingScene::addImageAsyncCallBack(CCObject *sender){
//android & iOS OK
CCTexture2D *texture2D = (CCTexture2D*)sender;
//android & iOS OK
//CCSprite *text = CCSprite::createWithTexture(texture2D);
//addChild(text);
//android crash iOS OK
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Mahjong_All.plist", texture2D);
}
BC4C9184-673B-465A-8479-5249F0774EEC.png (28.6 KB)