BOOL continueLoop;
CGPoint thePoint;
while(continueLoop != NO)
{
continueLoop = NO;
thePoint = [self generateRandomLocation];
NSMutableArray *blocks = [self getBlocksForX:thePoint.x];
for(BlueBlock *block in blocks)
{
if(block.getBlockLocationY == thePoint.y)
{
continueLoop = YES;
}
}
[blocks release];
}
这会在仪器中运行时导致崩溃,但在Xcode中不会导致崩溃。我把问题缩小了,当这行代码在循环中时会发生... NSMutableArray * blocks = [self getBlocksForX:thePoint.x];该方法返回一个NSMutableArray,我每次执行循环时都将它存储在块中,然后在循环结束时将其释放。什么会导致仪器崩溃?
答案 0 :(得分:3)
因为您永远不会alloc
,copy
或retain
阻止您发布它。
这样的错误可能有助于运行静态分析器。