问题描述
我有一个指向特定文件的文件路径,我希望在文件发生更改(其内容已被修改)时通知注册。
谷歌搜索,我找不到明确的答案。我已经尝试过使用kqueue和NSWorkspace,但是并没有取得太大的成功。
有什么方法可以做到这一点?
谢谢!
我有一个指向特定文件的文件路径,我希望在文件发生更改(其内容已被修改)时通知注册。
谷歌搜索,我找不到明确的答案。我已经尝试过使用kqueue和NSWorkspace,但是并没有取得太大的成功。
有什么方法可以做到这一点?
谢谢!
实现非常简单: 然后在委托方法中做您的业务。 $ b I have a file path to a specific file and I want to register to be notified whenever that file changes (its contents have been modified). I have tried searching google and I can't find a clear answer. I have experimented with kqueue and NSWorkspace but have not had much success. What is the proper way to do this? Thanks! I am using VDKQueue right now - author says it's a refactored and more performant version of UKKQueue. Implementation was pretty straightforward: Then just do your business in the delegate method. 这篇关于可可监视一个文件的修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
VDKQueueDelegate
;
VDKQueue *
ivar / property;
VDKQueue:receivedNotification:forPath:$ c
添加资源来监视addPath :notifyAbout:
。
VDKQueueDelegate
;VDKQueue*
ivar / property;VDKQueue:receivedNotification:forPath:
;addPath:notifyingAbout:
.