Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Chirone

macrumors 6502
Original poster
Mar 2, 2009
279
0
NZ
typo... woops... can this thread be deleted?

Code:
	NSDictionary *testDic = [NSDictionary dictionaryWithObjectsAndKeys: 
							 @"value1", @"key1", "@value2", @"key2", nil];
	NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
						  @"value1", @"key1", @"value2", @"key2", nil];

what's the difference between these two lines?
The difference is is that the first line (written by me) causes an uncatchable error (i put it in a try catch and it still crashed)
and the second line is from the documentation about NSDictionary

I see two completely identical lines (apart from the variable name)

I took out the first line and it worked fine, but as soon as it was put back in it crashed.

what could cause this?
 
Is it the EXEC_BAD_ACCESS error? If so, you're not properly retaining the dictionary--dictionaryWithObjectsAndKeys: gives an autoreleased object. Are you trying to access it outside of the scope where you create it?
 
yeah it was, could only see it with breakpoints

the typo is one the first line... "@key2" should be @"key2"
:rolleyes:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.