2 개의 타이머를 사용하여 일련의 활동 (A 및 B)을 만들고 싶습니다. 타이머를 무효로 할 때 몇 가지 문제가 발생합니다 ... 계속 하시겠습니까? 감사합니다 !!!NSTimer - 활동 순서 - 타이머를 무효화하는 방법?
timerAStart = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(startActivityA) userInfo:nil repeats:NO];
timerAStop = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(StopA) userInfo:nil repeats:NO];
timerBStart = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(startActivityB) userInfo:nil repeats:NO];
timerBStop = [NSTimer scheduledTimerWithTimeInterval:4 target:self selector:@selector(StopB) userInfo:nil repeats:NO];
- (void) StopA {
[timerAStart invalidate];
timerAStart=nil;
}
- (void) StopB {
[timerBStart invalidate];
timerBStart=nil;
}
'무효화'와 관련하여 어떤 문제가 있습니까? – mopsled
[timerAStart invalidate] 라인의 EXC_BAD_ACCESS; – Beppino66
호 또는 수동 보유 수를 사용하고 있습니까? – Pfitz