我有一本带有值的字典(self.dictMyDownloads):
{
1: {
id: "1",
name: "Venue Details",
url: "http://www.sapusers.org/event_files/3338_VENUE DETAILS KB.pdf",
file_size: "97011"
},
2: {
id: "2",
name: "another filename",
url: "test url 2",
file_size: "4321"
},
3: {
id: "3",
name: "Map/Directions",
url: "http://www.sapusers.org/event_files/3337_SAP UK Location Map HB.pdf",
file_size: "429320"
}
}
我正在运行此代码以将主字典中的字典插入到 nsmutablearray (self.mutArrMyDownloadsDetails) 中:
for(NSDictionary *dict in [self.dictMyDownloads allKeys]){
[self.mutArrMyDownloadsDetails addObject:[self.dictMyDownloads objectForKey:dict]];
}
但是当我显示结果时,添加到数组中的字典顺序发生了变化。
这是其显示的结果日志:
(
{
"file_size" = 97011;
id = 1;
name = "Venue Details";
url = "http://www.sapusers.org/event_files/3338_VENUE DETAILS KB.pdf";
},
{
"file_size" = 429320;
id = 3;
name = "Map/Directions";
url = "http://www.sapusers.org/event_files/3337_SAP UK Location Map HB.pdf";
},
{
"file_size" = 4321;
id = 2;
name = "another filename";
url = "test url 2";
}
)
我无法理解我在哪里或做错了什么。请帮忙。
谢谢。