How to detect if the iphone is synced when app is not running

631 views Asked by At

I would like to know if there is any way to detect if the iphone music library has changed when my app is not running.

There is a property lastModifiedDate in MPMediaLibrary class which does this but the problem i am facing is that this date changes even if the iPhone is not synced. The date generally changes if the now playing list or current playing list is changed in iPod.

Is there any other way to detect if the iPhone is synced?

2

There are 2 answers

1
Alex Stuckey On

You could use the lastModifiedDate and when the application is closed record the status of the playlists and then when the app is opened and the lastModifiedDate has changed: compare the current and previous playlists.

4
howanghk On

If a device sync with iTunes, it will clear the tmp folder under all apps. Therefore you may create a blank file in tmp, and next time when your application launch and found the file is missing, the device should have been synced. To obtain the tmp folder path, use NSTemporaryDirectory()