I am trying to save MPMediaItem in nsmutableDictionary ..
Actually my goal is to let the user select his songs, and then save it in the application, and then whenever he wants him to play.
I added this code to save MPMediaItem into the dictionary
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; [dict setObject:mediaItemCollection.representativeItem forKey:@"name"];
and added it to NSMutableArray, and then this array to NSUserDefaults.
but when I try to do this, I get this error:
[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '( { desc = Test; group = Main; msg = Test; name = test; rec = ( { name = "<MPConcreteMediaItem: 0x12b040> 8240103918041924793"; number = test; } ); type = "Play File"; } )' of class '__NSArrayM'. Note that dictionaries and arrays in property lists must also contain only property values.
source share