我的应用程序在 [super dealloc];
行和 - (void)dealloc
方法中崩溃,我释放了保留在 .h 类中的所有对象,崩溃报告是
-[__NSArrayI respondsToSelector:]: message sent to deallocated instance 0x86fb1a0
-[__NSArrayI respondsToSelector:]: message sent to deallocated instance 0x86fb1a0
-[__NSArrayI respondsToSelector:]: message sent to deallocated instance 0x86fb970
-[UIButton release]: message sent to deallocated instance 0x9b914b0
但是当我阻止 [super dealloc];
时发生了什么 这行代码完美地工作但是它给了我警告 Method possibly missing [super dealloc] call
。如果有人知道我做错了什么,请帮助我。提前致谢。
已编辑
[_gf_Knowledge_ratingStars release];
[_gf_Range_ratingStars release];
[_quality_ratingStars release];
[_atmosphere_ratingStars release];
[_reviewtxt release];
[_whatsGoodHere release];
[_saveButton release];
[_screen_title release];
[_commentImageView release];
[_resturantBGImageView release];
[_textViewPlaceholder release];
[_gFKnowledgeUnselectBtn release];
[_gFRangeUnselectBtn release];
[_gualityUnselectBtn release];
[_atmosphereUnselectBtn release];
[_gFKnowledgeLbl release];
[_gFRangeLbl release];
[_gualityLbl release];
[_atmosphereLbl release];
[_navbarImageView release];
[_btnBack release];
[super dealloc];
最佳答案
我认为您正在使用 arrayWithArray
静态方法将内存分配给 NSArray
。
以这种方式,它被添加到自动释放池中,保留计数将为 0。要么保留它,要么手动 alloc
[[NSArray alloc] init]
关于iphone - 应用程序在 super dealloc 方法中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16603088/