IOS5 file sharing: find out when files were added to the directory?

since the name says that I want to know how I can find out that a new file has been added to my application, for example, through iTunes Sync. In iOS4, I used methods

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

or

 - (void)application:(UIApplication *)application didBecomeActive 

But with iOS 5, this is useless, because the application will not go into the background and will not become active after synchronization. He remains active. So is there a way to solve this?

considers

Ralph

+4
source share
2 answers

If iTunes file sharing uses a new file coordination mechanism (I didn’t check, but I would assume that it is), you can implement the NSFilePresenter protocol to receive notifications of changes to the document directory.

It should be possible to use a single file representative for the entire directory, implementing presentedSubitemDidAppearAtURL: and its associated methods (see "Processing Changes to the NSFilePresenter Directory" in NSFilePresenter ).

+2
source

I usually create a timer and periodically check for new files in the directory shared by iTunes. I think that with iOS5 this is the best approach.

iOS5 can sync via WiFi, so you have no control over when the file will be added to the directory

0
source

All Articles