title: Objective-c FSEventStreamCreate
body: <p>I am trying to listen on a file change using FSEventStreamCreate - the callback is not called though. Following is the code, and should have worked as is, but?</p>
  
  <p>Thanks in advance</p>
  
  <pre><code>#import "FileChangeController.h"
  #include &lt;CoreServices/CoreServices.h&gt;
  
  @implementation FileChangeController
  
  - (id) init{
      self = [super init];
      if (self != nil) {
  //        fm = [NSFileManager defaultManager];
  //        images = [NSMutableArray new];
          [self initializeEventStream];
      }
      return self;
  }
  
  - (void) awakeFromNib{
  
  }
  
  void fsevents_callback(ConstFSEventStreamRef streamRef,
                         void *userData,
                         size_t numEvents,
                         void *eventPaths,
                         const FSEventStreamEventFlags eventFlags[],
                         const FSEventStreamEventId eventIds[])
  {
      //FileChangeController *ac = (__bridge FileChangeController *)userData;
      NSLog(@"Test");
      size_t i;
      for(i=0; i&lt;numEvents; i++){
          //[ac addModifiedImagesAtPath:[(NSArray *)eventPaths objectAtIndex:i]];
          //[ac updateLastEventId:eventIds[i]];
      }
  }
  
  - (void) initializeEventStream
  {
      NSString *myPath = @"/Users/NameOfUser/Desktop/Untitled.js"; //NSHomeDirectory();
      NSArray *pathsToWatch = [NSArray arrayWithObject:myPath];
      void *appPointer = (__bridge void *)self;
      FSEventStreamContext context = {0, appPointer, NULL, NULL, NULL};
      NSTimeInterval latency = 3.0;
  
      stream = FSEventStreamCreate(NULL,
                                   &amp;fsevents_callback,
                                   &amp;context,
                                   (__bridge CFArrayRef) pathsToWatch,
                                   kFSEventStreamEventIdSinceNow, //[lastEventId unsignedLongLongValue],
                                   (CFAbsoluteTime) latency,
                                   kFSEventStreamCreateFlagUseCFTypes
                                   );
  
      FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
      FSEventStreamStart(stream);
  }
  
  @end
  </code></pre>