Ios development verification code counts down 60 seconds, the real machine test goes back to the background and opens again to find that the number of seconds has not changed. what should I do?

  ios, question

__block int timeout=60;

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
 dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue);
 dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0);  //Execute per second
 dispatch_source_set_event_handler(_timer, ^{
 dispatch_async(dispatch_get_main_queue(), ^{
 [self.validbtn setttle: @ "get SMS Verification Code" forstate: uicontrolstatermal];
 //self.validBtn.backgroundColor=RGB(120, 0, 103);
 [self.validbtn setbackgroundmage: [uiimageimagenamed: @ "get verification code"] forstate: uicontrolstatenormal];
 self.validBtn.userInteractionEnabled = YES;
 int seconds = timeout;
 Nsstring * strtme = [nsstringstringwithformat: @ "percentage.2d", seconds];
 dispatch_async(dispatch_get_main_queue(), ^{
 [self.validbtn setttle: [nsstringstringwithformat: @ "percent @ second", strtime] forstate: uicontrolstatermal];
 //self.validBtn.backgroundColor=RGB(207, 207, 207);
 [self.validbtn setbackgroundmage: [uiimageimagenamed: @ "get verification code-not clickable"] forstate: uicontrolstatermal];
 self.validBtn.userInteractionEnabled = NO;

End the thread when leaving the current page, and then initialize the countdown to 60