iosdevnyc
iosdevnyc

Reputation: 1871

Monitoring if File is currently open Mac App

My app create a file on the FS and opens the file in other application(s). I want to monitor the file for changes which I already have in place, but I also want to know when the other application has closed the file. Is there some API that currently exists on mac, and it's an API that will not get my app rejected from the app store ?

Upvotes: 0

Views: 81

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89559

I believe the thing you're looking for is in FSEvents (File System Events), specifically the FSEventStreamCreate function with the FSEventStreamEventFlag kFSEventStreamEventFlagItemModified.

As long as it's a file within the user's sandbox (or one that the user has given permission to use), I would think you should be okay for the app store.

More information can be found in this related question.

Upvotes: 2

Related Questions