如何在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”at。
所以对于最后一行来说,确实不需要“currVertPos”,但这真的很重要,如果不是,我怎么能使警告静音?
答案 0 :(得分:7)
不,警告无关紧要;你可以简单地通过不做商店来消除它。从最后一行删除currVertPos =
,没有什么可以警告你。
答案 1 :(得分:7)
另一种选择是使用:
#pragma unused(currVertPos)
Source: https://stackoverflow.com/questions/194666/is-there-a-way-to-suppress-warnings-in-xcode