objective-c – 堆栈跟踪中__forwarding__是什么意思?

前端之家收集整理的这篇文章主要介绍了objective-c – 堆栈跟踪中__forwarding__是什么意思?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
(gdb) bt
#0  0x302ac924 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ ()
#1  0x92077e3b in objc_exception_throw ()
#2  0x302d6ffb in -[NSObject doesNotRecognizeSelector:] ()
#3  0x3026e056 in ___forwarding___ ()
#4  0x3024a0a2 in __forwarding_prep_0___ ()
#5  0x00004ae9 in -[GameObject doesTouch:] (self=0xe893a0,_cmd=0x643ee,obj=0xe82e20) at /Users/aaa/Desktop/CPT/Game/Classes/GameObject.m:220
#6  0x00006e05 in -[StaticGrid checkTouchNearest:] (self=0xe82f20,_cmd=0x64ec3,obj=0xe893a0) at /Users/aaa/Desktop/CPT/Game/Classes/StaticGrid.m:62
#7  0x0000a393 in -[EAGLView touchesBegan:withEvent:] (self=0xe8dad0,_cmd=0x3199fa3c,touches=0x632c0b0,event=0xe14590) at /Users/aaa/Desktop/CPT/Game/Classes/EAGLView.m:459
#8  0x30910f33 in -[UIWindow _sendTouchesForEvent:] ()
#9  0x308faecb in -[UIApplication sendEvent:] ()
#10 0x309013e1 in _UIApplicationHandleEvent ()
#11 0x32046375 in PurpleEventCallback ()
#12 0x30245560 in CFRunLoopRunSpecific ()
#13 0x30244628 in CFRunLoopRunInMode ()
#14 0x32044c31 in GSEventRunModal ()
#15 0x32044cf6 in GSEventRun ()
#16 0x309021ee in UIApplicationMain ()
...

目前我有一个罕见的发生错误,我不知道原因.我不知道在哪里看,所以我想问的是前五行(#0到#4)是什么意思?我知道它声称有一些错误,但是那些东西就像“___forwarding___”?

如果你有这方面的知识,请帮忙.非常感谢你.

解决方法

转发内容用于uhm …转发消息.每个对象都可以轻松地将收到的消息转发给其他对象,请参阅优秀的 tutorial by Scott Stevenson.当您的GameObject收到一条不明白的消息时,会尝试转发它.如果没有执行转发,则会调用didNotRecognizeSelector方法,并获得异常.

详细描述可以在Apple documentation中找到NSObject类:

When an object is sent a message for
which it has no corresponding method,
the runtime system gives the receiver
an opportunity to delegate the message
to another receiver. It delegates the
message by creating an NSInvocation
object representing the message and
sending the receiver a
forwardInvocation: message containing
this NSInvocation object as the
argument. The receiver’s
forwardInvocation: method can then
choose to forward the message to
another object.
(…)
NSObject’s implementation of
forwardInvocation: simply invokes the
doesNotRecognizeSelector: method; it
doesn’t forward any messages. Thus,if
you choose not to implement
forwardInvocation:,sending
unrecognized messages to objects will
raise exceptions.

对于你的错误,似乎GameObject发送了一些不明白的消息.这可能是一个简单的打字错误或者像内存管理错误那样更微妙的东西,你必须给我们更多的信息.

猜你在找的C&C++相关文章