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

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -