NSTimer and Selector
NSTimer and Selector
- Subject: NSTimer and Selector
- From: Andrew James <email@hidden>
- Date: Wed, 11 Apr 2007 06:48:34 +0930
Hi,
Im having some trouble here with a selector, for some reason it keeps
giving me the below error:
2007-04-10 21:00:00.348 SleepLock[7030] *** -[NSCFTimer
scheduledTimerWithTimeInterval:invocation:repeats:]: selector not
recognized [self = 0x37bf60]
2007-04-10 21:00:00.349 SleepLock[7030] *** -[NSCFTimer
scheduledTimerWithTimeInterval:invocation:repeats:]: selector not
recognized [self = 0x37bf60]
These are the two functions isolated and they both have their
brothers in the .h file
-(IBAction)timerItem:(id)sender{
[[NSUserDefaults standardUserDefaults] synchronize];
int timerPeriod;
timerPeriod = [[NSUserDefaults standardUserDefaults]
integerForKey:@"timerPeriod"];
if (timerPeriod == nil) {
[timerPanel makeKeyAndOrderFront:nil];
} else {
//timerPeriod = (timerPeriod * 60);
NSInvocation *theInvocation = [NSInvocation
invocationWithMethodSignature:[self
methodSignatureForSelector:@selector(lockScreen)]];
[theInvocation setSelector:@selector(lockScreen)];
[theInvocation setTarget:self];
NSTimer * lockTimer = [[NSTimer alloc]
scheduledTimerWithTimeInterval:timerPeriod
invocation:theInvocation
repeats:YES];
NSLog(@"Timer added to runLoop");
[[NSRunLoop currentRunLoop] addTimer:lockTimer
forMode:NSDefaultRunLoopMode];
}
}
-(void)lockScreen{
screenLock *sl = [[screenLock alloc] init]; // now we have a
screenLock instance named sl
[sl initLock];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden