-5
以下は私のソースコードですが、私はその理由を知らない。 は、誰も私に説明でき.ThankそんなにNSTimerと同時にアクションが重複していませんか?
- (void)onTimer:(NSTimer *)timer {
long currentPlaybackTime = self.player.currentPlaybackTime;
int currentHours = (currentPlaybackTime/3600);
int currentMinutes = ((currentPlaybackTime/60) - currentHours*60);
int currentSeconds = (currentPlaybackTime % 60);
self.currentLabel.text = [NSString stringWithFormat:@"%i:%02d:%02d", currentHours, currentMinutes, currentSeconds];
if(currentMinutes > 0 && currentSeconds == 5)
{
//duplicate action at here.
NSLog(@"Make a thread to decrypt file buffer");
[self bufferEncryption];
}
}
コールタイマー:?
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(onTimer:) userInfo:nil repeats:YES];
私が試してみてください。
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(onTimer:) userInfo:nil repeats:NO];
タイマーが一つだけround.Whyを呼び出しますか?
よろしく、あなたのコメントに答える
あなたはなぜ「何か」を知りませんか? –
おそらくOPはそれを書いていることを覚えていません。彼はそれがなぜ存在するのか知りたいと思っています:)。 – borrrden
申し訳ありませんが、問題は、秒が5のとき、私は2つのデバッグログ行を持っています。 NSLog(@ "ファイルバッファを解読するためのスレッドを作る"); NSLog(@ "ファイルバッファを解読するスレッドを作る"); –