Hi All,
I'm working on an iPhone App which uses the MediaPicker to play songs from the device's iPod library. I create a playlist of songs which I save the to users preferences. Trouble is, if the user syncs their phone and removes songs which are in the stored playlist, the App crashes the next time they try to use it. So - I need a way of knowing whether the device has been synced between the last use and the current use of my App - I can then just alert the user and get them to re-select songs for their playlist. Simple - except I can't determine a way of checking if the device has been synced recently. Anyone done this or got any thoughts?
One method which looked promising was the MediaLibrary class from the MediaPlayer framework. It has a property lastModifiedDate.
[[MPMediaLibrary defaultMediaLibrary] lastModifiedDate]
So I thought I could simply check this value against a stored value from my App of when the App had last run and clear the playlist if the library had been updated more recently. But when I log this value I just get 1st Jan 1970. Obviously not the real value. Has anyone had success with this value?
The only other approach is to check the items in the playlist are available to play and copy them to a new playlist, leaving out any which are no longer available on the device's iPod library - except I don't think the MediaPlayer has a method to check a song is available before attempting to play it. If anyone knows a method that would be a good solution too.
I hope that makes sense - any ideas would be gratefully received. Thanks