ios - NSTimer not firing, has correct method signature -
i'm using nstimer call method every second, doesn't work. can call manually using [refreshtimer fire]; otherwise doesn't work. ideas why?
here initialize timer:
refreshtimer = [nstimer scheduledtimerwithtimeinterval:2.0 target:self selector:@selector(sendrefreshpacket:) userinfo:nil repeats:yes]; and method:
- (void)sendrefreshpacket: (nstimer*) timer { nslog(@"test"); }
try this:
dispatch_async(dispatch_get_main_queue(), ^{ refreshtimer = [nstimer scheduledtimerwithtimeinterval:2.0 target:self selector:@selector(sendrefreshpacket:) userinfo:nil repeats:yes]; });
Comments
Post a Comment