質問

I do it like this.

NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:allMyNameObjects forKeys:allMySizeObjects];

allMyNameObjects = {a,b,c,d}

allMySizeObjects = {1,2,1,3}

And is dictionary = {a:1,b:2,d:3}

"c" does not appear, because it has same size with "a".

allMySizeObjects objects has in NSNumber

Why it does not work with the same key? And how to make that work? Thank you all for your help.

役に立ちましたか?

解決

NSDictionary keys must be unique.

You can reverse keys with objects

NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:allMySizeObjects forKeys:allMyNameObjects];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top