问题
I have file tree in my Documents folder. What is the easiest way to watch all changes in Documents folder and in all its subfolders? I've already read about kqueue but it seems that it works only for folder itself(not for its subfolders).
回答1:
The cost of scanning the file system is relatively high if you can't do it using a function built into the OS.
For iOS, your app file system can't really change while the app is running. iTunes can sync some file which may be an issue for you but generally, while the app is open, it is only the app that is making changes. So, the app should deal with this situation by posting notifications about the change events so that other classes inside the app can observe them and deal with the situation accordingly.
Your notifications can also include details of what changed in the userInfo
dictionary.
来源:https://stackoverflow.com/questions/19632106/file-system-watching-in-ios