For the life of me, I cannot figure out why this NSTimer wont fire. here is all of the code that appears relevant (at least to me)
- (IBAction)connectClick:(id)sender
{
if (connected)
{
NSLog(@"Disconnecting");
[timer invalidate];
timer = nil;
connected = NO;
[Connect setStringValue:@"Connect"];
NSLog(@"Finished\n");
}
else
{
NSLog(@"Connecting");
timer = [NSTimer timerWithTimeInterval:2.0 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES];
//[timer fire]; tested this line. same results
[Connect setStringValue:@"a"];
connected = YES;
NSLog(@"Finished\n");
}
}
- (void)timerFireMethod:(NSTimer*)theTimer
{
NSLog(@"Fireing event");
//[self resetRequest];
//[spinner startAnimation:nil];
//[request startAsynchronous];
}
I have read the apple docs, and other questions, but I cannot figure it out. It does not even call timerDireMethod:
once. I have heard this could be caused by different threads, but as far as I can tell, I am not using multiple threads.
All ideas welcome.