NSEventTrackingRunLoopMode not found error

Discussion in 'iOS Programming' started by mikezang, Jan 22, 2011.

  1. macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    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?

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

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Uh hu. So if you look up NSRunLoop in the iOS documentation 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 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.
     
  3. thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    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?
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    None? There is no such thing as a "a mouse-dragging loop" on iOS.
     
  5. thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #5
    Well, I did it, thanks again.
     
  6. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    Did what? :confused:
     

Share This Page