title: Invoking a function for every 5 seconds in iOS
body: <p>Is it possible to invoke a function in iOS for a certain time interval? </p>
  
  <pre><code>  {
      NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self  selector:@selector(serverConnect) userInfo:nil repeats:YES]; 
    }
  </code></pre>
  
  <p>Is there an alternative to the above?</p>
  
  <p>The server connect function is as follows: </p>
  
  <pre><code>  -(void)serverConnect{
  
  NSMutableURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@MYURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
  
  NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request delegate:self];
  
  if(connection){
  
      NSLog(@"connected");
  }else{
      //
  
  }
  </code></pre>
  
  <p>It throws an error: -[TUTViewController serverConnect:]: unrecognized selector sent to instance 0x907ef20</p>