NSDictionary causing EXC_BAD_ACCESS
Posted
by aks
on Stack Overflow
See other posts from Stack Overflow
or by aks
Published on 2010-06-16T22:20:53Z
Indexed on
2010/06/16
22:22 UTC
Read the original article
Hit count: 263
objective-c
I am trying to call objectForKey: on an nsdictionary ivar, but I get an EXC_BAD_ACCESS error. The nsdictionary is created using the JSON-framework and then retained. The first time I use it (just after I create it, same run loop) it works perfectly fine, but when I try to access it later nothing works. I am doing this code to try to figure out what is wrong:
if (resultsDic == nil) {
NSLog(@"results dic is nil.");
}
if ( [resultsDic respondsToSelector:@selector(objectForKey:)] ) {
NSLog(@"resultsDic should respond to objectForKey:");
}
The dictionary is never nil, but it always crashes on respondsToSelector. any ideas?
© Stack Overflow or respective owner