I need to pass an array of CoreData entities from my main view to a TableViewController.
I used a lot of stackoverflow posts to help myself with that, and thought it worked.
But when I build my app, I have a thread problem, displaying:
[NSTaggedPointerString count]: unrecognized selector sent to instance".
I did some checks and the problem is, in my tableView, the number of Row is set to 0.
So here is my code :
My prepareForSegue function in my MainViewController.m:
(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"sgPushDetail"])
{
checkDataSavedTableViewController *detail = segue.destinationViewController;
detail.datasToDisplay = _listOfDatas;
}
}
listOfDatas is an NSArray of NSManagedObject, declared in my MainViewController.h
datasToDisplay is an NSArray declared in my TableViewController.
Here is my function to put my datas in the TableViewController:
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"dataCells" forIndexPath:indexPath];
NSString *rowArray = self.datasToDisplay[indexPath.row];
cell.textLabel.text = rowArray;
return cell;
}
(But the error appears in the ViewDidLoad so meeeh)
How can I proceed further?
OK I AM STUPID.
Since I use CoreData, I already have a list of my entities. I don't need my NSArray of randomMeh, I just need that:
NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"Contact" inManagedObjectContext:context];