tags:

views:

15

answers:

1

Hello every one

I hope to add audio from audio library to a MPMediaItemCollection. I hope I can store the MPMediaItemCollection
So I write the MPMediaItemPropertyPersistentID to an array. When I need to reload and replay the audio MPMediaItemCollection, I check if the audio's MPMediaItemPropertyPersistentID existes in current audio librabry.

Is it possible?

Or use MPMediaItemPropertyPersistentID to check that is not a good solution.

Thanks

A: 

The documentation on MPMediaItemPropertyPersistentID is pretty clear on what you can expect:

The value of the MPMediaItemPropertyPersistentID identifier persists across application launches and across syncs that do not change the sync status of the media item. The value is not guaranteed to persist across a sync/unsync/sync cycle.

So if the user unsyncs a song and later syncs it back to the device, the persistent ID might have changed. In this case, your check would wrongly report that the song was not available. Nevertheless, as this is probably a pretty rare event, I think yours is a good approach.

Ole Begemann