Problem while looping on a NSDictionary
- by Tom
Hi!
The end of my loop causes a EXC_BAD_ACCESS.
Here's my dictionary (AppDelegate.data):
1 = (
3,
"Test 1",
False,
""
);
2 = (
4,
"Test 2",
False,
""
);
And here is my loop:
for (id theKey in AppDelegate.data) {
if (theKey = nil) {
NSLog(@"HOLY COW");
} else {
NSLog(@"Key: %@ ?", theKey);
}
}
It never says holy cow, and it says the right key but at the end it crashes...
Do you have any idea why? It should only loop on 1 and two and then exit the loop... I know that there's always a "nil" object at the end that's why I did a condition with it but it doesn't look like it works at all..
Thanks!