在 Obj-C 中,我试图将数组保存到NSUserDefaults
我得到一个错误。我想这是因为数组是多维的,但是解决这个问题的最佳方法是什么?我应该将整个对象编码/解码为字符串,还是应该以某种方式调整对象?
以下是警告信息。我已经用“...”替换了一些匹配对象,以使帖子不会长 100 英里。
提前致谢!
*** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '(
{
items = (
{
awayName = Celtic;
awayScore = 0;
channel = TV3Sport1;
dateEnd = 1377018000;
dateStart = 1377010500;
description = "Playoff til Champions League, 1. kamp.";
hash = 05ec41bd5cb91fe559349391c007994d;
homeName = "Shakhter Karagandy";
homeScore = 0;
leagueTitle = "Champions League (kval)";
matchProgress = "";
matchStart = 1377010800;
stream = "";
},
{
awayName = "Real Sociedad";
awayScore = 0;
channel = TV3Sport1;
dateEnd = 1377031500;
dateStart = 1377023400;
description = "Playoff til Champions League, 1. kamp.";
hash = be7a7e4763038c6991ba9f6cddfce871;
homeName = Lyon;
homeScore = 0;
leagueTitle = "Champions League (kval)";
matchProgress = "";
matchStart = 1377024300;
stream = "";
}
);
unix = 1376949600;
},
{
items = (
{...);
unix = 1377036000;
},
{
items = (...);
unix = 1377122400;
},
{
items = (...);
unix = 1377208800;
},
{
items = (...);
unix = 1377295200;
},
{
items = (...);
unix = 1377381600;
},
{
items = (...);
unix = 1377468000;
},
{
items = (...);
unix = 1377554400;
}
)' of class '__NSCFArray'. Note that dictionaries and arrays in property lists must also contain only property values.