Hi I have a problem in my code. I want to launch the thread but when it is launched they can't start a NSTimer istruction. Can you help me?
-(void)detectionMove:(NSTimer*)timer{
int indexArray = [[[timer userInfo] objectForKey:@"arrayIndex"] intValue];
// do something
}
-(void)callDectectionMove:(NSNumber*)arrayIndex{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
NSMutableDictionary *myDictionary = [[NSMutableDictionary alloc] init];
[myDictionary setObject:arrayIndex forKey:@"arrayIndex"];
//This istruction can't lunch a detectionMove method
[NSTimer scheduledTimerWithTimeInterval:timeToCatch target:self selector:@selector(detectionMove:) userInfo:myDictionary repeats:NO];
[pool release];
}
-(void)detectPositionMovement{
for(int i = 0; i< [self.arrayMovement count]; i++){
if((actualAccelerometerX+sensibilityMovement) > [[[[self.arrayMovement objectAtIndex:i] arrayPositionMove]objectAtIndex:0] valueX] && (actualAccelerometerX-sensibilityMovement) < [[[[self.arrayMovement objectAtIndex:i] arrayPositionMove]objectAtIndex:0] valueX] &&
(actualAccelerometerY+sensibilityMovement) > [[[[self.arrayMovement objectAtIndex:i] arrayPositionMove]objectAtIndex:0] valueY] && (actualAccelerometerY-sensibilityMovement) < [[[[self.arrayMovement objectAtIndex:i] arrayPositionMove]objectAtIndex:0] valueY] &&
(actualAccelerometerZ+sensibilityMovement) > [[[[self.arrayMovement objectAtIndex:i] arrayPositionMove]objectAtIndex:0] valueZ] && (actualAccelerometerZ-sensibilityMovement) < [[[[self.arrayMovement objectAtIndex:i] arrayPositionMove]objectAtIndex:0] valueZ])
[NSThread detachNewThreadSelector:@selector(callDectectionMove:) toTarget:self withObject:[NSNumber numberWithInt:(int)i]];
}
}