我有2 NSArray
與內容ID和其他內容的URL與NSDictionary的合作,陣列
但是,當我創建NSDictionary
它的外觀像這樣(從NSLog
):
2015-07-03 17:10:51.072 hibridTesting[4950:166675] {
(
) = (
);
(
30,
31
) = (
"https://www.google.com",
"https://www.yahoo.com"
);
(
10,
11,
12,
13
) = (
"https://www.facebook.com/",
"https://www.sapo.pt",
"https://www.sapo.pt",
"https://www.sapo.pt"
);
(
20,
21,
22,
23,
24,
25
) = (
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://www.google.com"
);
}
,如果我這樣做這
arrayDeSitesSubmenus = [mydictionary objectForKey:@"21"];
,如果打印我arrayDeSitesSubmenus
它說nil
。
我想是每個ID的網址,以及我的理解是關鍵的小組,一組網址
的編輯:
我的日誌從陣列是:
2015-07-03 17:33:55.771 hibridTesting[5122:174427] (
(
"https://www.facebook.com/",
"https://www.sapo.pt",
"https://www.sapo.pt",
"https://www.sapo.pt"
),
(
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://www.google.com",
"https://www.google.com"
),
(
"https://www.google.com",
"https://www.yahoo.com"
),
(
),
(
),
(
),
(
)
)
2015-07-03 17:33:55.771 hibridTesting[5122:174427] (
(
10,
11,
12,
13
),
(
20,
21,
22,
23,
24,
25
),
(
30,
31
),
(
),
(
),
(
),
(
)
)
我把我的數組從xmlparse,這就是爲什麼我的日誌看起來像 謝謝。
您沒有正確創建您的'NSDictionary'。關鍵不是@「21」,而是從20到25的「NSArray」和相應的URL。使用這個:'[NSDictionary dictionaryWithObjects:arrayURLs forKeys:arrayIds];' – Larme