iphone - Probelem with NSTimer -
i have problem nstimer
. received "sigabrt" error , [nscftimer intvalue]: unrecognized selector sent instance
these code:
-(void)detectionmove:(nsnumber*)arrayindex{ static bool notfind = false; static int countvariable = 0; static int countrilevamenti = 0; notfind = false; for(int = countvariable+1; i<[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]count]; i++){ if(!notfind){ if((actualaccelerometerx+sensibilitymovement) >= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuex] && (actualaccelerometerx-sensibilitymovement) <= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuex] && (actualaccelerometery+sensibilitymovement) >= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuey] && (actualaccelerometery-sensibilitymovement) <= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuey] && (actualaccelerometerz+sensibilitymovement) >= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuez] && (actualaccelerometerz-sensibilitymovement) <= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuez]) { countvariable = i; notfind = true; countrilevamenti++; } } } if(!notfind) return; else if(countvariable+1 == [[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]count]){ if(countrilevamenti + tollerance >= [[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]count]) movementdetected = [arrayindex intvalue]; else nslog(@"troppo veloce"); countvariable = 0; notfind = false; countrilevamenti = 0; return; } [nstimer scheduledtimerwithtimeinterval:timetocatch target:self selector:@selector(detectionmove:) userinfo:(nsnumber*)arrayindex repeats:no]; }
you have wrong signature method
- (void)timerfiremethod:(nstimer*)thetimer
not nsnumber
--edit2--
nsmutabledictionary *mydictionary = [[nsmutabledictionary alloc] init]; [mydictionary setobject:arrayindex forkey:@"index"]; [nstimer scheduledtimerwithtimeinterval:timetocatch target:self selector:@selector(detectionmove:) userinfo:mydictionary repeats:no];
--edit--
if want keep old method can call somewhere else nsnumber
argument have create new method nstimer
call , in implementation of nstimer
method call nsnumber
method whatever number appropriate.
-(void)detectionmove:(nsnumber*)arrayindex{ // still whatever } -(void)automaticdetectionmove:(nstimer*)thetimer{ [self detectionmove:whatevernumber]; } // update new method name [nstimer scheduledtimerwithtimeinterval:timetocatch target:self selector:@selector(automaticdetectionmove:) userinfo:(nsnumber*)arrayindex repeats:no];
Comments
Post a Comment