我試圖挽救MPMediaItem中的NSMutableDictionary ..保存MPMediaItem成的NSMutableDictionary
其實我的目的是讓用戶選擇他的歌曲,然後把它保存在應用程序,那麼只要他願意,他可以打。
我已經加入此代碼,用於保存MPMediaItem到字典
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:mediaItemCollection.representativeItem forKey:@"name"];
,並在加入的NSMutableArray,然後該數組NSUserDefaults的進入。
但是當我嘗試這樣做我得到這個錯誤:
[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.