Reputation: 40506
When I plug in the iPhone to iTunes and drag a file into the File Sharing section of my app, the app on the screen goes away for a moment and then comes back. It seems that none of the app delegate methods are triggered at this time, not even something like "went to background, went to foreground".
As soon as my app comes back after a sync where the user added or removed files, I want to update the screen.
Maybe there is a notification beeing sent?
Upvotes: 3
Views: 1268
Reputation: 3200
Also, <MediaPlayer/MediaPlayer.h>
framework's [MPMediaLibary defaultMediaLibrary]
can post notification MPMediaLibraryDidChangeNotification
, which is fired especially when your media library is updated while your device is syncing with iTunes.
You can let your object to observe this notification by adding:
#import <MediaPlayer/MediaPlayer.h>
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(<#selector#>:) name:MPMediaLibraryDidChangeNotification object:[MPMediaLibrary defaultMediaLibrary]];
Also make sure to activate this notification by using - (void)beginGeneratingLibraryChangeNotifications
Upvotes: 6
Reputation: 2561
applicationWillResignActive does not work starting with iOS 5.0.
You can use the DirectoryWatcher class in the DocInteraction sample app.
Upvotes: 1
Reputation: 90117
- (void)applicationWillResignActive:(UIApplication *)application
is called when the sync starts and - (void)applicationDidBecomeActive:(UIApplication *)application
after the sync is complete
Upvotes: 4