如何在XCode中屏蔽不需要的"死店"警告?

Gre*_*reg 2 iphone xcode ios xcode4

如何在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 
Run Code Online (Sandbox Code Playgroud)

警告详细信息=永远不会读取存储在"currVertPos"处的值.

所以对于最后一行来说,确实不需要"currVertPos",但这真的很重要,如果不是,我怎么能使警告静音?

Gab*_*abe 7

不,警告无关紧要; 你可以简单地通过不做商店来消除它.currVertPos =从最后一行删除,没有什么可以警告你的.


小智 7

另一种选择是使用:

#pragma unused(currVertPos)
Run Code Online (Sandbox Code Playgroud)

资料来源:/sf/ask/13626651/