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

henktade

macrumors newbie
Original poster
Jan 30, 2009
17
0
hello guys

I have the following code in my project which i use to copy an array to NSArray. the content come from a server using JSON.

Code:
test.subStreams = (NSArray *)[[[feed1 valueForKey:@"product"] valueForKey:@"menu"] valueForKey:@"subMenu"];

this works fine and I was able to check that subStreams have some values. but when ever I try to access this values I get the following runtime error.

Code:
-[NSNull isEqualToString:]: unrecognized selector sent to instance 0xa05e5020

any suggestion will be appreciated.
 
Last edited by a moderator:

HiRez

macrumors 603
Jan 6, 2004
6,250
2,576
Western US
What type of objects are in the array? Strings? Are they NSStrings? Can you post the code you're using to test accessing the objects? You say you've confirmed that subStreams have values but then you say you can't access the values so I'm a little confused. In any case it seems some value is null, so I don't think your array got populated correctly with valid Objective-C objects. What you might need to do is loop through the returned JSON list and create an NSString for each item, then add it to the array.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
I'm guessing you're using some third-party JSON code and are either running into a bug in the code, or running into an NSNull object and you're assuming it's something else. Check the return values of each of the valueForKey: methods instead of assuming each object is valid.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.