ios - Watch OS2 NSTimer problems -
i'm working on app need start timer (using nstimer) when watch activated. timer asks information iphone (about every 1 seconds , maximum 5 seconds). i'm using start timer
timer = [nstimer scheduledtimerwithtimeinterval:2 target:self selector:@selector(myfunction) userinfo:nil repeats:no];
in "myfunction" function, restart timer next time.
- (void) myfunction { //here update label text // [...] [timer invalidate]; timer = nil; counter++; if(counter<5) { timer = [nstimer scheduledtimerwithtimeinterval:2 target:self selector:@selector(myfunction) userinfo:nil repeats:no]; } }
my problem in simulator works fine in real watch (watch-os2 gm) timer doesn't start or starts 1 time , after seems freeze! see because update label in watch @ every elapsed period shows counter , i'm sure initialized in "will activate" function. don't understand why. same issue?
i having similar , equally frustrating issue main timer has alert timer going off @ regular intervals. works in simulator not watch. hear start sound first alert , nothing. starting timers button rather when watch activates. have same type of code running on published app phone works. cannot find solution. unbelievably frustrating. have had further success resolving issue?
Comments
Post a Comment