MPMediaItem and MPMediaItemCollection support NSCoding , so you can serialize it and save it using NSKeyedArchiver , see the documentation . If obj is any object that supports NSCoding ,
NSData*data=[NSKeyedArchiver archivedDataWithRootObject:obj];
converts it to an instance of NSData . Or you can get the permanent identifier of the MPMediaItemPropertyPersistentID song
NSNumber*persistentID=[mediaItem valueForProperty:MPMediaItemPropertyPersistentID];
and then yo ucan save persistentID somewhere, like NSUserDefaults .
source share