title: Check a condition in the background every ten seconds and send notification
body: <p>I'm working on an app for Mac OS X. My app checks something every ten seconds, and if the condition is true, the app sends a Growl notification.</p>
  
  <p>I've already coded the Growl notifications and the checking. I just need to know how to make this checking repeat itself every ten seconds, and each time send a notification if true, all in the background.</p>
  
  <p>Please write the exact code, as I am very new to Objective-C. Thank you :D</p>
  
  <p>-------------------------------EDIT------------------------------------</p>
  
  <p>Currently i'm using this:</p>
  
  <pre><code>//  MyApp_AppDelegate.m
  
  #import "MyApp_AppDelegate.h"
  
  @implementation MyApp_AppDelegate
  
  - (void)awakeFromNib {
      return;
  }
  
  
  -(void)applicationDidFinishLaunching:(NSNotification*)aNotification {
  
      // grwol:
      NSBundle *myBundle = [NSBundle bundleForClass:[MyApp_AppDelegate class]];
      NSString *growlPath = [[myBundle privateFrameworksPath] stringByAppendingPathComponent:@"Growl-WithInstaller.framework"];
      NSBundle *growlBundle = [NSBundle bundleWithPath:growlPath];
  
      #include &lt;unistd.h&gt;
  
      int x = 0;
      int l = 10; // time/repeats
      int t = 10; //seconds
      while ( x &lt;= l ) {
  
          // more code here only to determine sendgrowl value...
  
          if(sendgrowl) {
              if (growlBundle &amp;&amp; [growlBundle load]) {
                  // more code to sends growl
              } else {
                  NSLog(@"ERROR: Could not load Growl.framework");
              }
          }
  
          // do other stuff that doesn't matter...
  
          // wait:
          sleep(t);
  
          x++;
      }
  }
  
  /* Dealloc method */
  - (void) dealloc { 
      [super dealloc]; 
  }
  
  @end
  </code></pre>