File system watching in iOS

江枫思渺然 提交于 2019-12-11 18:18:57

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!