2011-04-04 127 views
0

即時通訊使用xcode4和box2d/cocos2d。使用box2d的奇怪xcode錯誤

我有一些奇怪的困難與運行時錯誤,隨機彈出。
我認爲他們發生更多的時候,我不會停止重建/運行前的過程。
通常,如果我停止過程之前我重建/運行錯誤不會發生。

有時我得到一個:

'NSInvalidArguementException', reason '-[ConstructLayer createCog:::]: unrecognized selector sent to instance 0x554ecd0.

有時候我在一個文件中一個奇怪的錯誤叫:

llvm:InstCombiner::DoOneIteration(llvm::Function&, unsigned int)_disassembly_0x026bc64f.nasm

與行強調​​:

0x02bc64f <+0439> mov 0x20(%eax),%ecxn

And sometimes i get an error: malloc * error for object 0x68d4ba4: incorrect checksum for freed object - object was probably modified after being freed.

這裏是我的dealloc方法:

- (void) dealloc{ 
delete world; 
world = NULL; 
body_block1 = NULL; 
body_egg = NULL; 
body_poly = NULL; 

[_block1 release]; 
[_egg release]; 
[_poly release]; 
[super dealloc]; 
} 

究竟發生了什麼?通常錯誤在連續發生三次,並且在重新開始運行之前發生錯誤。
幫助!
謝謝,
奧利弗。

回答

1

嘗試在釋放它之後創建一個數組nil。

[_block1 release]; 
_block = nil; 

[_egg release]; 
_egg = nil; 

[_poly release]; 
_poly = nil;