Autoscroll の例から Apple TapDetectingImageView クラスを使用しています。
静的アナライザーには、次の警告が表示されます。
Classes/TapDetectingImageView.m:68:30:{68:17-68:29}: 警告:
The left operand of '==' is a garbage value
if (tapCounts[0] == 1 && tapCounts[1] == 1) {
~~~~~~~~~~~~ ^
以下の添付コードの場合。最初に初期化せずに変数を読み取ると、ガベージ値が発生します。しかし、tapCounts は既に初期化されているようです。
アプリが正常に動作している場合は無視できますか、それとも何か変更する必要がありますか?
BOOL allTouchesEnded = ([touches count] == [[event touchesForView:self] count]);
// first check for plain single/double tap, which is only possible if we haven't seen multiple touches
if (!multipleTouches) {
UITouch *touch = [touches anyObject];
tapLocation = [touch locationInView:self];
if ([touch tapCount] == 1) {
[self performSelector:@selector(handleSingleTap) withObject:nil afterDelay:DOUBLE_TAP_DELAY];
} else if([touch tapCount] == 2) {
[self handleDoubleTap];
}
}
// check for 2-finger tap if we've seen multiple touches and haven't yet ruled out that possibility
else if (multipleTouches && twoFingerTapIsPossible) {
// case 1: this is the end of both touches at once
if ([touches count] == 2 && allTouchesEnded) {
int i = 0;
int tapCounts[2]; CGPoint tapLocations[2];
for (UITouch *touch in touches) {
tapCounts[i] = [touch tapCount];
tapLocations[i] = [touch locationInView:self];
i++;
}
if (tapCounts[0] == 1 && tapCounts[1] == 1) { // it's a two-finger tap if they're both single taps
tapLocation = midpointBetweenPoints(tapLocations[0], tapLocations[1]);
[self handleTwoFingerTap];
}
}