星期五快乐。有一个有趣的时间调试一个僵尸问题。我有一个从加载的对象UITableView
中获取其数据源的方法。(见下面的课程)。当应用程序加载时,一切都很好 - 第一个 8 或 9 个单词按预期显示在表格视图中。但是,当我滚动时,我的对象中出现了僵尸,正如调试器输出“<Zombie>”作为类实例变量值的值所证明的那样。(见截图)。这会导致崩溃。NSMutableArray
Word
Word
Word
TableSearch[12440:207] *** -[CFString respondsToSelector:]: message sent to deallocated instance 0x6b1fe70
这是Word类
//Word Class
#import "Word.h"
@implementation Word
@synthesize word;
@synthesize definition;
+ (id)wordWith:(NSString *)word Definition:(NSString *)definition
{
Word *newWord = [[[self alloc] init] autorelease];
newWord.word = word;
newWord.definition = definition;
return newWord;
}
- (void)dealloc
{
[word release];
[definition release];
[super dealloc];
}
@end
我确信这是愚蠢的,但我看不出我哪里出错了。
我在 Instruments 上运行了“Analyze”,没有报告任何问题。崩溃后,我运行了“malloc_history 12440 0x6b1fe70”并查看了输出,但不知道要查找什么,除了具有僵尸的对象的类名,我没有看到。
非常感谢任何跟踪此问题的帮助。
谢谢!