iTunes 同步/文件传输完成时 iOS 中的通知回调

人气:504 发布:2022-10-16 标签: filesystemwatcher itunes sync ios5

问题描述

我已经搜索了如何在文件系统发生更改时在 iOS5 中接收回调.我从 Apple 的网站上找到了以下示例,但它仅在删除/创建文件时通知给定的委托.

I have searched for how to receive callbacks in iOS5 when the file system has changed. I've found the following sample from Apple's site, but it only notifies the given delegate when a file is removed/created.

DocInteraction 示例应用中的DirectoryWatcher 类

DirectoryWatcher class in the DocInteraction sample app

http://developer.apple.com/library/ios/#samplecode/DocInteraction/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010052

是否可以进行 API 调用来接收同步完成"回调事件?请注意,用户可能会传输大文件,我需要知道传输何时完成.此外,在 iOS5 中,iTunes 同步可以在后台进行,这意味着您的应用程序不一定要离开前台;因此不调用此方法:

Is there an API call that I can make to receive a "sync is complete" callback event? Note, a user might transfer large files and I need to know when the transfer is complete. Also, in iOS5, iTunes sync can occur in the background, meaning that your application doesn't necessarily leave the foreground; hence this method is not called:

- (void)applicationDidBecomeActive:(UIApplication *)application

推荐答案

我获取了 DirectoryWatcher 代码并进行了一些修改以轮询文件大小.https://github.com/hwaxxer/MHDirectoryWatcher

I took the DirectoryWatcher code and made some modifications to poll the file sizes. https://github.com/hwaxxer/MHDirectoryWatcher

184