The object at 0x3814530 is a NSString and yet you treat it as a NSDictionary, and you get a runtime exception.
This article describes breaking on exceptions. Use the debugger to inspect the code that is adjacent to your exception.
The object at 0x3814530 is a NSString and yet you treat it as a NSDictionary, and you get a runtime exception.
This article describes breaking on exceptions. Use the debugger to inspect the code that is adjacent to your exception.
Hi Sam,
The error message is a bit cryptic, but it basically says that you tried to send the message "objectForKey:" to an object of class "NSString", and that method doesn't exist in the NSString class. It sounds like you're programatically grabbing an object and expecting that object to be an NSDictionary. At runtime, your NSDictionary * is actually being set to an NSString *, and you don't get an exception until that object is actually used incorrectly.
The fact that you can say "give me this object of unknown type, assume it's a dictionary, and call this function" is actually pretty cool once you get comfortable with Objective-C, but it's hell to get used to. I've always found that Objective-C assumes you know what you're doing. Some people love it because it lets them write clean, concise code -- but it raises the learning curve quite a bit.
Feel free to post a code snippet if you need more help tracking this one down!
UPDATE:
It looks like when you setup your data in viewDidLoad:, you are loading a bunch of arrays from separate files. Then you add the contents of those arrays to your main data array like this:
[listOfItems addObjectsFromArray:arrayStructuresF];
I think those lines shouldn't be there. Further down, you're creating dictionaries for each letter and then adding those to the listOfItems. At the end of the function, listOfItems contains a whole bunch of string items AND a whole bunch of dictionaries. The string items come first, so you're getting NSStrings when you expect NSDictionaries.
P.S. You might want to condense some of this into loops once it's all working. You could create an array of the letters A,B,C,D, etc... and then load all the files in a loop using filenames made using NSString's stringWithFormat:. Just a thought!
Try turning on NSZombiesEnabled.
I'm betting you'll find you're sending a message to an object that's already been released to the point that it's been deallocated.