我以NSUserDefaults
这种方式保存了一些字典:
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"event_states"] == nil)
{
NSDictionary *dict0 = [NSDictionary dictionaryWithObjectsAndKeys:
@"923381DC-3DCB-46CA-A6CF-C58A7AF33B89",@"guid",
@"В планах",@"name", //this string will returned corrupted
[NSNumber numberWithInt:12632256],@"color",
[NSNumber numberWithInt:0],@"isclosed",
[NSNumber numberWithInt:0],@"isfinish",
nil];
// and few more dictionaries same way
....
[[NSUserDefaults standardUserDefaults] setObject:@[dict0,dict1,dict2,dict3] forKey:@"event_states"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
NSArray *event_states = [[NSUserDefaults standardUserDefaults] objectForKey:@"event_states"];
当我检索这些数据时,我正在记录它并且有一个奇怪的行为。在某些情况下,我正在检索正确的值,如下所示:
name = "\U0412 \U043f\U043b\U0430\U043d\U0430\U0445"
但在某些情况下是这样的:
name = "\U0412\U044b\U043f\U043e\U043b\U043d\U0435\U043d(\U043e)
括号中的最后一部分是一个额外的符号,我不明白它为什么出现以及它何时出现和何时不出现的依赖关系。这有什么问题?