问题描述
如何在 XCode 中屏蔽不需要的"死存储"警告?那就是我有这段代码,我认为这不是问题,所以如果是这种情况,我不想继续看到警告......(欢迎反馈)
代码在这里:
// Position and Size Labels in Cell CGFloat currVertPos = 0; // Maintain lowest position, i.e. starting vertical point for next cell // Set Position & Get back next veritical position to use currVertPos = [self resizeLabel:_mainLabel atVertPos:currVertPos]; currVertPos = [self resizeLabel:_mainLabel2 atVertPos:currVertPos]; currVertPos = [self resizeLabel:_mainLabel3 atVertPos:currVertPos]; currVertPos = [self resizeLabel:self.secondLabel atVertPos:currVertPos]; // WARNING OCCURS HERE
警告详细信息 = 永远不会读取存储在"currVertPos"处的值.
所以最后一行确实不需要"currVertPos",但这真的很重要吗?如果不是,我如何才能使警告静音?
推荐答案
不,警告无关紧要;你可以通过不做商店来消除它.删除最后一行的 currVertPos = 就没有什么需要警告的了.