PDA

View Full Version : NSEventTrackingRunLoopMode not found error




mikezang
Jan 22, 2011, 05:17 AM
I use code as below, but got error when compile ViewController.m:316:0 'NSEventTrackingRunLoopMode' undeclared (first use in this function)
What can I do?

-(void) StartTimer {
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerTick:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
}



robbieduncan
Jan 22, 2011, 05:25 AM
Uh hu. So if you look up NSRunLoop in the iOS documentation (http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSRunLoop_Class/Reference/Reference.html) you see that constant is not defined in NSRunLoop. It may be defined in one of NSConnection or NSApplication. Given the name we will assume it's not NSConnection (as it's modes start with NSConnection). NSApplication does not exist on iOS.

This can be confirmed by looking at the NSApplication (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html) documentation.

So in short: that mode does not exist and cannot be used on iOS.

And please learn to use the documentation. Almost every single question you ask can be answered in a few short moments by reading the documentation for yourself.

mikezang
Jan 22, 2011, 08:49 AM
Uh hu. So if you look up NSRunLoop in the iOS documentation (http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSRunLoop_Class/Reference/Reference.html) you see that constant is not defined in NSRunLoop. It may be defined in one of NSConnection or NSApplication. Given the name we will assume it's not NSConnection (as it's modes start with NSConnection). NSApplication does not exist on iOS.

This can be confirmed by looking at the NSApplication (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html) documentation.

So in short: that mode does not exist and cannot be used on iOS.

And please learn to use the documentation. Almost every single question you ask can be answered in a few short moments by reading the documentation for yourself.
Thanks for your advise, though I also found that document,I couldn't find why I can't use it, so I asked here.
By the way, back to my question, can you tell me which mode in iOS can be used to do the same thing?

robbieduncan
Jan 22, 2011, 08:55 AM
Thanks for your advise, though I also found that document,I couldn't find why I can't use it, so I asked here.
By the way, back to my question, can you tell me which mode in iOS can be used to do the same thing?

None? There is no such thing as a "a mouse-dragging loop" on iOS.

mikezang
Jan 22, 2011, 09:35 AM
None? There is no such thing as a "a mouse-dragging loop" on iOS.
Well, I did it, thanks again.

dejo
Jan 22, 2011, 02:55 PM
Well, I did it, thanks again.

Did what? :confused: