As I looked for answers from google and here most of the answer says that you are trying to use length on an NSArray which is not supported.
The problem here is I don't even use any NSArray or length in my code.
I got a
NSMutableArray *filteredContent;
where filteredContent
will contain dictionaries from a plist.
Everything runs great until writing cell.textLabel.text
on the cell for tableView
.
Checked with NSLog
and the content is indeed an array.
This is how I try to write the cell text:
cell.textLabel.text=[[self.filteredContent objectAtIndex:indexPath.row] valueForKey:@"recipeName"];
But it gives me error so i changed it to:
NSString *myValue = [self.filteredContent valueForKey:@"recipeName"];
cell.textLabel.text=myValue;
Yet the result is the same. I have no idea what I am getting this error.
Further details:
[results addObject:@[recipe]];
This is where i create my main array and than pass it to the PageView
with segue filteredContent = results
EDIT:
recipe = arrayOfPlist[i];
where arrayOfPlist
NSArray *arrayOfPlist = [[NSArray alloc] initWithContentsOfFile:path];
//Output to NSLog(@"FIltered Content : %@", self.filteredContent);
FIltered Content : (
(
{
category = main;
difficultyLevel = "3/5";
numberOfPerson = 5;
recipeDetail = "Bulguru koy su koy beklet pisir ye ";
recipeImage = "nohutlu-pilav.jpg";
recipeIngredients = "pirinc,tereyag tuz,bulgur";
recipeName = "Bulgurlu Pilav";
time = "25 dk";
}
),
(
{
category = main;
difficultyLevel = "3/5";
numberOfPerson = 5;
recipeDetail = "Bulguru koy su koy beklet pisir ye ";
recipeImage = "nohutlu-pilav.jpg";
recipeIngredients = "pirinc,tereyag tuz,bulgur";
recipeName = "Bulgurlu Pilav";
time = "25 dk";
}
)
)
2014-04-27 02:47:41.704 deneme2[19820:60b] VALUE IN FILTERED TABLE is (
"Bulgurlu Pilav" // this is what i want to write to the cell label and i get it with myValue-look a bit above
)
Based on the output of your data, you have an extra array in there. So you want this:
cell.textLabel.text = self.filteredContent[indexPath.row][0][@"recipeName"];
Each element of your filteredContentArray is another array. Each of those inner arrays has the dictionary with the data you want.