"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://p开发者_StackOverflow社区astebin.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.
You are trying to call a method (selector) isEqualToString on an NSDictionary object. This doesn't support the isEqualToString method - hence the error.
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.
精彩评论