嗨我继续在IOS设备上遇到此崩溃,但我无法确切地知道它为什么会发生。我正在使用崩解剂进行错误报告,但即使从那里我也无法从中获取很多东西。已附加问题的日志跟踪。这是一个知道问题还是有什么可以解决这个问题?
d : Crashed: com.apple.main-thread
0 MyApp 0x00000001008195a4 cocos2d::SpriteFrame::getTexture() + 2098468
1 MyApp 0x0000000100812ff4 cocos2d::Sprite::initWithSpriteFrame(cocos2d::SpriteFrame*) + 2072436
2 MyApp 0x0000000100525f84 js_cocos2dx_Sprite_initWithSpriteFrameName(JSContext*, unsigned int, JS::Value*) + 581860
3 MyApp 0x0000000100711694 js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) + 1017364
4 MyApp 0x000000010070d55c Interpret(JSContext*, js::RunState&) + 1000668
5 MyApp 0x0000000100706694 js::RunScript(JSContext*, js::RunState&) + 972308
6 MyApp 0x00000001007117a0 js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) + 1017632
7 MyApp 0x0000000100711ae4 js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value const*, JS::MutableHandle<JS::Value>) + 1018468
8 MyApp 0x0000000100639a80 JS_CallFunctionName(JSContext*, JS::Handle<JSObject*>, char const*, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) + 133632
9 MyApp 0x0000000100595d74 ScriptingCore::executeFunctionWithOwner(JS::Value, char const*, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) + 12632
10 MyApp 0x0000000100595dcc ScriptingCore::executeFunctionWithOwner(JS::Value, char const*, JS::HandleValueArray const&) + 12720
11 MyApp 0x00000001005280b8 js_cocos2dx_Sprite_constructor(JSContext*, unsigned int, JS::Value*) + 590360
12 MyApp 0x0000000100711c4c js::InvokeConstructor(JSContext*, JS::CallArgs) + 1018828
13 MyApp 0x000000010070d548 Interpret(JSContext*, js::RunState&) + 1000648
14 MyApp 0x0000000100706694 js::RunScript(JSContext*, js::RunState&) + 972308
15 MyApp 0x00000001007117a0 js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) + 1017632
16 MyApp 0x000000010065f874 js::CallOrConstructBoundFunction(JSContext*, unsigned int, JS::Value*) + 288756
17 MyApp 0x0000000100711694 js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) + 1017364
18 MyApp 0x0000000100711ae4 js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value const*, JS::MutableHandle<JS::Value>) + 1018468
19 MyApp 0x0000000100639b18 JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) + 133784
20 MyApp 0x0000000100584a50 JSFunctionWrapper::invoke(unsigned int, JS::Value*, JS::MutableHandle<JS::Value>) + 896
21 MyApp 0x0000000100559c48 std::__1::__function::__func<js_cocos2dx_MenuItemSprite_initWithNormalSprite(JSContext*, unsigned int, JS::Value*)::$_17, std::__1::allocator<js_cocos2dx_MenuItemSprite_initWithNormalSprite(JSContext*, unsigned int, JS::Value*)::$_17>, void (cocos2d::Ref*)>::operator()(cocos2d::Ref*&&) + 794024
22 MyApp 0x00000001007737f0 std::__1::function<void (cocos2d::Ref*)>::operator()(cocos2d::Ref*) const + 1419120
23 MyApp 0x00000001007f9700 cocos2d::MenuItem::activate() + 1967744
24 MyApp 0x00000001007f8764 cocos2d::Menu::onTouchEnded(cocos2d::Touch*, cocos2d::Event*) + 1963748
25 MyApp 0x0000000100851bc8 std::__1::function<void (cocos2d::Touch*, cocos2d::Event*)>::operator()(cocos2d::Touch*, cocos2d::Event*) const + 2329416
26 MyApp 0x000000010084f894 std::__1::__function::__func<cocos2d::EventDispatcher::dispatchTouchEvent(cocos2d::EventTouch*)::$_3, std::__1::allocator<cocos2d::EventDispatcher::dispatchTouchEvent(cocos2d::EventTouch*)::$_3>, bool (cocos2d::EventListener*)>::operator()(cocos2d::EventListener*&&) + 2320404
27 MyApp 0x0000000100850554 std::__1::function<bool (cocos2d::EventListener*)>::operator()(cocos2d::EventListener*) const + 2323668
28 MyApp 0x000000010084cce0 cocos2d::EventDispatcher::dispatchEventToListeners(cocos2d::EventDispatcher::EventListenerVector*, std::__1::function<bool (cocos2d::EventListener*)> const&) + 2309216
29 MyApp 0x000000010084d13c cocos2d::EventDispatcher::dispatchTouchEvent(cocos2d::EventTouch*) + 2310332
30 MyApp 0x000000010084ce44 cocos2d::EventDispatcher::dispatchEvent(cocos2d::Event*) + 2309572
31 MyApp 0x0000000100862818 cocos2d::GLView::handleTouchesOfEndOrCancel(cocos2d::EventTouch::EventCode, int, long*, float*, float*) + 2398104
32 MyApp 0x0000000100858b4c -[CCEAGLView touchesEnded:withEvent:] + 2357964
33 UIKit 0x0000000186c68a2c -[UIWindow _sendTouchesForEvent:] + 700
34 UIKit 0x0000000186c61f68 -[UIWindow sendEvent:] + 684
35 UIKit 0x0000000186c3518c -[UIApplication sendEvent:] + 264
36 UIKit 0x0000000186ed6324 _UIApplicationHandleEventFromQueueEvent + 15424
37 UIKit 0x0000000186c336a0 _UIApplicationHandleEventQueue + 1716
38 CoreFoundation 0x00000001821ac240 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
39 CoreFoundation 0x00000001821ab4e4 __CFRunLoopDoSources0 + 264
40 CoreFoundation 0x00000001821a9594 __CFRunLoopRun + 712
41 CoreFoundation 0x00000001820d52d4 CFRunLoopRunSpecific + 396
42 GraphicsServices 0x000000018b8eb6fc GSEventRunModal + 168
43 UIKit 0x0000000186c9afac UIApplicationMain + 1488
44 MyApp 0x00000001000c7694 main (main.m:8)
45 libdyld.dylib 0x0000000194096a08 start + 4
答案 0 :(得分:0)
我认为SpriteFrame
可能是nullptr
。
bool Sprite::initWithSpriteFrame(SpriteFrame *spriteFrame)
{
CCASSERT(spriteFrame != nullptr, "");
bool bRet = initWithTexture(spriteFrame->getTexture(), spriteFrame->getRect());
setSpriteFrame(spriteFrame);
return bRet;
}
CCASSERT
无法在发布时使用,因此在spriteFrame->getTexture()
时会崩溃。