在iOS中监视文件系统 [英] File system watching in iOS

查看:58
本文介绍了在iOS中监视文件系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文档"文件夹中有文件树.在文档"文件夹及其所有子文件夹中查看所有更改的最简单方法是什么?我已经读过有关kqueue的信息,但它似乎仅适用于文件夹本身(不适用于其子文件夹).

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).

推荐答案

如果无法使用操作系统内置的功能进行扫描,则扫描文件系统的成本相对较高.

The cost of scanning the file system is relatively high if you can't do it using a function built into the OS.

对于iOS,您的应用文件系统在运行时无法真正更改.iTunes可以同步一些文件,这可能对您来说是个问题,但是通常情况下,当该应用程序打开时,只有该应用程序才能进行更改.因此,应用程序应通过发布有关变更事件的通知来处理这种情况,以便应用程序内的其他类可以观察到它们并相应地处理情况.

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.

您的通知还可以包含 userInfo 词典中更改内容的详细信息.

Your notifications can also include details of what changed in the userInfo dictionary.

这篇关于在iOS中监视文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆