I setup a FSEvent that runs well but it keeps reporting the same event each time I launch the app.
Ex:
My FSEvent monitor directory is:
Test/
…and there are three files:
test1, test2, test3
However, after I deleted test1 in my FSEvent Directory, it keeps telling me that test1 has been deleted every time I run the program instead of just the one time after the deletion.
I cleaned all managedObjects in my context and deleted the whole directory but the event keeps being reported.
What should I do such that it only tells me right after the deletion and then never again?
Thanks a lot!
File system event are persistent between launches. They are tracked by the file system itself, not the app. That is why you keep seeing the event every time you launch.
I believe you have to callFSEventsPurgeEventsForDeviceUpToEventIdor the like to clear the events.Take that with a grain of salt. I haven’t fiddled with it much.
Edit:
From File System Events Programming Guide:
I think the important thing to remember is that the file system events are not actually stored or even related to app that is observing them. They exist independently of the app in the file system itself. In practice, several different apps could be set to observe the same event.