Hi,

I'm using this code to get a notification when a file has been updated:

- (void)startReading
{
NSString *logPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Logs/MyTestApp.log"];
        NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:logPath];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
        [notificationCenter addObserver:self
                                                                                
         selector:@selector(getData:)
                                                                                          
       name:@"NSFileHandleReadCompletionNotification"
                                                                                
           object:fh];
        [fh readInBackgroundAndNotify];
}

- (void) getData: (NSNotification *)aNotification
{
        NSLog(@"hai");
}

I know for sure that the file is being updated (MyTestApp.log), however the selector method (getData:) is never being called. Is there something I'm doing wrong?

Thanks
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to