Kasper
Kasper

Reputation: 11

"Unrecognized selector sent to instance" using JSON and UITableView

I am importing data from a website using TouchJson. This data is supposed to be viewed in a UITableVIew. The app is a Tab Bar based app. When I run the app it crashed with the following error, throwing an exception in the following line:

Error: [__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance

Code: cell.textLabel.text = [recipeSection objectAtIndex:row];

My cellForRowAtIndexPath's source code is found here: http://pastebin.com/s3xr4NTc

The JSON I use is found here: http://muncken.myftp.org/eatstrong2/iphone/recipeList.php

My target is to show the recipes as an indexed UITableView, but I am doing it stepwise.

Upvotes: 1

Views: 2126

Answers (2)

Nick Bull
Nick Bull

Reputation: 4286

You are trying to call a method (selector) isEqualToString on an NSDictionary object. This doesn't support the isEqualToString method - hence the error.

Upvotes: 2

Cyprian
Cyprian

Reputation: 9453

The error is saying that you are trying to use a method of an NSArray objectAtIndex on a NSCFDictioanry object. It will happen if at this line:

NSArray *recipeSection = [recipes objectForKey:key];

your objectForKey returns NSDictionary instead of expected NSArray.

Upvotes: 0

Related Questions